Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I founda bug in lav's header operations!

Its a comment but it messed me up for a second.

Code:
party_remove_members                  = 1615  # (party_remove_members, <party_id>, <troop_id>, <number>),
                                              # Removes specified number of troops from a party. Stores number of actually removed troops in reg0.
party_remove_prisoners                = 1616  # (party_remove_members, <party_id>, <troop_id>, <number>),
                                              # Removes specified number of prisoners from a party. Stores number of actually removed prisoners in reg0.
 
kalarhan said:
BeefBacon said:
Time to leather jerkin everything - obviously the most professional and expert way to fix any and all problems.

lol I am glad I am not the one testing and doing the code review on this project  :mrgreen:

are you going to have MP on your mod? Otherwise you can remove all that stuff from the modsys, and also from the game menu (see tutorials for the game_variables.txt file)

Yup, tried just deleting it and had no problems. Beats replacing everything.

Code:
("loot_player_items",
    [
      (store_script_param, ":enemy_party_no", 1),
      
      (troop_get_inventory_capacity, ":inv_cap", "trp_player"),
      (try_for_range, ":i_slot", 0, ":inv_cap"),
        (troop_get_inventory_slot, ":item_id", "trp_player", ":i_slot"),
        (ge, ":item_id", 0),
        (troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":i_slot"),
        (try_begin),
          (is_between, ":item_id", trade_goods_begin, trade_goods_end),
          (assign, ":randomness", 20),
        (else_try),
          (this_or_next|is_between, ":item_id", horses_begin, horses_end),
          (this_or_next|eq, ":item_id", "itm_warhorse_sarranid"),
          (eq, ":item_id", "itm_warhorse_steppe"),
          (assign, ":randomness", 15),

So I've nearly gotten rid of all the legacy items I don't want, and I've understood pretty much everything I've done so far, and what the scripts I've been editing have related to. However, the above code has got me a bit confused. I know it has something to do with looting, but I'm not sure what exactly, or why.

So I'm assuming that this relates to when you get beaten in battle (or maybe when you defeat somebody else) and they steal (or you take) loot, but I'm not sure why it's referring to specific items. I'm less keen to simply replace all these items without knowing why exactly they're being referenced.
 
BeefBacon said:
but I'm not sure what exactly, or why.

buy stuff, get into a battle, lose it (defeat), wait until you can escape, check your inventory again  :mrgreen:

game steals some of your stuff. That is controlled by that script.

It checks some categories (is this a trade item, is this a horse, ...), it gives a chance value (%), it rolls a dice to decide if that item should be removed, ... repeats for the entire inventory. It marks the item on the enemy party.

And it steals your cash.
 
kalarhan said:
BeefBacon said:
but I'm not sure what exactly, or why.

buy stuff, get into a battle, lose it (defeat), wait until you can escape, check your inventory again  :mrgreen:

game steals some of your stuff. That is controlled by that script.

It checks some categories (is this a trade item, is this a horse, ...), it gives a chance value (%), it rolls a dice to decide if that item should be removed, ... repeats for the entire inventory. It marks the item on the enemy party.

And it steals your cash.

I thought so. I do get what it's doing - I had assumed that it was % chance to lose that type of item, but I'm not clear on why it's referring to specific items like a specific horse rather than just saying "there's a 50% chance you'll lose a horse." Is it trying to define horse A as the start of the horse list and horse B as the end of the horse list or something? As I recall the horse that are referenced are right next to each other, so the start/end thing can't be the case. Or maybe it's referring to those specific items? So there's an X% chance to lose any horse, and an X% chance to lose that specific horse? Though that doesn't seem quite right.

I mean I can probably just stick itm_courser in there and be done with it, but it's always good to fully understand.
 
BeefBacon said:
Is it trying to define horse A as the start of the horse list and horse B as the end of the horse list or something?

yes

like mentioned a few times in early posts: module_constants.py, ranges, ID_xxx.py files, tutorials, keep stuff in the same category inside the original range

in other words: how does the game knows that a horse is a horse? A sword is sword? A boot is a boot? Native uses ranges and constants for that

from VC
Code:
horses_begin = "itm_common_horse"
horses_end = "itm_arrows"

Code:
itm_common_horse = 130
itm_common_horse2 = 131
itm_common_pony = 132
itm_common_pony2 = 133
itm_wild_horse = 134
itm_wild_horse2 = 135
itm_wild_pony = 136
itm_wild_pony2 = 137
itm_cow1 = 138
itm_cow2 = 139
itm_arrows = 140

MBScript is zero based. And loops are minus 1. So if you want to add 10 new horses, put them between the listed constants, so it will magically identify the new stuff as horses.

Code:
itm_common_horse = 130
itm_common_horse2 = 131
itm_common_pony = 132
itm_common_pony2 = 133
itm_wild_horse = 134
itm_wild_horse2 = 135
itm_wild_pony = 136
itm_wild_pony2 = 137
itm_cow1 = 138
itm_cow2 = 139

itm_common_elephant = 140
itm_common_elephant2 = 141
itm_common_elephant3 = 142

itm_arrows = 143
 
Hey guys, how would I go about making an object always drop, only if a player dies and not if knocked unconscious?
 
Ramaraunt said:
only if a player dies and not if knocked unconscious?

?

Player is immortal (hero), our troop can't die.

did you by chance meant that he was captured after losing the battle? Or are you talking about something else, MP, a evil spell, some unholy feature from a obscure mod,... ?
 
kalarhan said:
Ramaraunt said:
only if a player dies and not if knocked unconscious?

?

Player is immortal (hero), our troop can't die.

did you by chance meant that he was captured after losing the battle? Or are you talking about something else, MP, a evil spell, some unholy feature from a obscure mod,... ?

Its not a hero, its a normal troop that drops the head.
 
Ramaraunt said:
Its not a hero, its a normal troop that drops the head.

so it is not a player, guess the word you were looking for was agent  :grin:

check the triggers on header_triggers.py for mission template, and you will find one that handles the death/unconscious event. You can use it to decide about the head.
 
I'm having difficulty adding Formations/FormAI to my mod. Does the modmerger still work? I get a ton of errors, so either I've done something wrong or modmerger no longer works.

Code:
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Traceback (most recent call last):
  File "process_items.py", line 72, in <module>
    write_items(variables,variable_uses,tag_uses,quick_strings)
  File "process_items.py", line 31, in write_items
    get_weight(item[6]),
  File "E:\Steam\SteamApps\common\MountBlade Warband\Modules\EDITOR\module\Module_system 1.171\header_items.py", line 171, in get_weight
    a = (y >> ibf_weight_bits) & ibf_armor_mask
TypeError: unsupported operand type(s) for >>: 'AGGREGATE' and 'int'
Exporting scene data...
Exporting troops data
Traceback (most recent call last):
  File "process_troops.py", line 107, in <module>
    save_troops()
  File "process_troops.py", line 45, in save_troops
    strength = (attrib & 0xff)
TypeError: unsupported operand type(s) for &: 'AGGREGATE' and 'int'
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Error: Unable to find object:mesh_mp_ui_host_maps_21
ERROR: Illegal Identifier:mesh_mp_ui_host_maps_21
Error: Unable to find object:mesh_ccoop_random_class
ERROR: Illegal Identifier:mesh_ccoop_random_class
Error: Unable to find object:mesh_ccoop_random_class
ERROR: Illegal Identifier:mesh_ccoop_random_class
Error: Unable to find object:mesh_ccoop_random_class
ERROR: Illegal Identifier:mesh_ccoop_random_class
Error: Unable to find object:mesh_ccoop_random_class
ERROR: Illegal Identifier:mesh_ccoop_random_class
Error: Unable to find object:mesh_ccoop_default_class
ERROR: Illegal Identifier:mesh_ccoop_default_class
Error: Unable to find object:mesh_ccoop_default_class
ERROR: Illegal Identifier:mesh_ccoop_default_class
Error: Unable to find object:mesh_ccoop_default_class
ERROR: Illegal Identifier:mesh_ccoop_default_class
Error: Unable to find object:mesh_ccoop_default_class
ERROR: Illegal Identifier:mesh_ccoop_default_class
Error: Unable to find object:mesh_ccoop_melee_class
ERROR: Illegal Identifier:mesh_ccoop_melee_class
Error: Unable to find object:mesh_ccoop_melee_class
ERROR: Illegal Identifier:mesh_ccoop_melee_class
Error: Unable to find object:mesh_ccoop_melee_class
ERROR: Illegal Identifier:mesh_ccoop_melee_class
Error: Unable to find object:mesh_ccoop_melee_class
ERROR: Illegal Identifier:mesh_ccoop_melee_class
Error: Unable to find object:mesh_ccoop_ranged_class
ERROR: Illegal Identifier:mesh_ccoop_ranged_class
Error: Unable to find object:mesh_ccoop_ranged_class
ERROR: Illegal Identifier:mesh_ccoop_ranged_class
Error: Unable to find object:mesh_ccoop_ranged_class
ERROR: Illegal Identifier:mesh_ccoop_ranged_class
Error: Unable to find object:mesh_ccoop_ranged_class
ERROR: Illegal Identifier:mesh_ccoop_ranged_class
Error: Unable to find object:mesh_ccoop_mounted_class
ERROR: Illegal Identifier:mesh_ccoop_mounted_class
Error: Unable to find object:mesh_ccoop_mounted_class
ERROR: Illegal Identifier:mesh_ccoop_mounted_class
Error: Unable to find object:mesh_ccoop_mounted_class
ERROR: Illegal Identifier:mesh_ccoop_mounted_class
Error: Unable to find object:mesh_ccoop_mounted_class
ERROR: Illegal Identifier:mesh_ccoop_mounted_class
Error: Unable to find object:mesh_prison_cart_pos
ERROR: Illegal Identifier:mesh_prison_cart_pos
Error: Unable to find object:mesh_incoming_enemy
ERROR: Illegal Identifier:mesh_incoming_enemy
Error: Unable to find object:mesh_incoming_enemy
ERROR: Illegal Identifier:mesh_incoming_enemy
Error: Unable to find object:mesh_ccoop_drop_chest_top
ERROR: Illegal Identifier:mesh_ccoop_drop_chest_top
Error: Unable to find object:mesh_ccoop_drop_chest_bottom
ERROR: Illegal Identifier:mesh_ccoop_drop_chest_bottom
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

I'm not really expecting the errors to be resolved here, that's just what I get when I try to use modmerger. I think I know how to deal with the ccoop stuff. The rest I'm not so sure about. But again, I suppose the main question is "does modmerger still work"?

I'm very keen on having the Formations/FormAI mod. Native battle AI is mindless. There's actually a few smaller mods that add features that I forgot weren't in Native, but better AI tops the list.
 
BeefBacon said:
I get a ton of errors, so either I've done something wrong or modmerger no longer works.

read the error messages and track down the issues. At a quick glance it looks like syntax issues with your code.

And you should look for a newer version of Formations OSP (based on the latest code from VC), make sure you are not using a old version. There are operations for items stats now (like weight), and other improvements which make using the feature a lot easier and better for performance (less laggy) on big battles.

if you are not aware the Formations OSP kit was created by one of VC developers, and it was used in the DLC as well (the reviewed version)
 
BeefBacon said:
Found a newer version of the mod, from 2016, and used the version of modmerger that it shipped with. No errors, but the changes didn't appear in-game either.

1) When talking about a OSP you should include the link, we can't guess which one you are using
2) You are probably missing steps, like adding the triggers to your mission templates, etc. This should be explained somewhere either on the OSP thread (usually the first post) or on a .txt file with the download
 
I have a problem with the mod I am working on  at the moment. I am trying to make a target troop type of a quest, but it seems to be storing the id of the troop in a funny manner. It appears to me almost as if it is not storing the id from ID_troops.py, but is instead storing the id of a random troop of that type on the map, because the id is well over 50 million! I feel there is something I don't understand about storing troop ids in quest slots, so can someone please explain to me if I am doing something wrong. Here is the some info:

Code:
SCRIPT ERROR ON OPCODE 2324: Invalid Troop ID: 51700448; LINE NO: 5:
At dialog condition: dlga_bounty_quest_say: bounty_quest_accept_or_deny.
At dialog condition: dlga_bounty_quest_say: bounty_quest_accept_or_deny.

The OPCODE is refeering to this method:
Code:
(str_store_troop_name_by_count, <string_register>, <troop_id>, <number>),

Here is some of the code I used to store the troop id in the quest slot:


#In script_get_quest
Code:
(assign,":cur_target_troop","trp_sea_raider"),
...
(assign, ":quest_target_troop", ":cur_target_troop"),
...
(quest_set_slot, ":result", slot_quest_target_troop, ":quest_target_troop"),
#in module_ dialogues.py
Code:
... 
 [anyone|auto_proceed,"bounty_quest_calculate", [
	   (call_script, "script_get_quest", "$g_talk_troop"), #get the quest.
       (assign, "$random_quest_no", reg0), #store the quest id in the global.
  ],
  "{!}Warning: This line should never display.", "bounty_quest_say",[]],
  ...
 #The rogue party quest (questgiver explanation)
  [anyone,"bounty_quest_say",[
	#init stuff
	(eq,"$random_quest_no","qst_dead_or_alive_party"), #if the quest is this one
  
	#village stuff
	(quest_get_slot,":village","$random_quest_no",slot_quest_target_center), #get the village that is going to be spawned around
	(str_store_party_name, s10, ":village"), #store the name of the village in s10
	
	#troops
	(quest_get_slot,":troop","$random_quest_no",slot_quest_target_troop), #grab the bandit troop from slot
	(quest_get_slot,":troop_count","$random_quest_no",slot_quest_target_amount), #get the amount of bandits in the party
	(str_store_troop_name_by_count, s8, ":troop", ":troop_count"), #store descriptive string in s8
	
	#money
	(quest_get_slot,reg12,"$random_quest_no",slot_quest_gold_reward),
	(store_div,reg13,reg12,4), #calculate the decreased reward for bringing him back dead (3/4ths)
	(val_mul,reg13,3),
	
	#string initialization
	(str_store_string,s14,"str_job_hunt_army"),
	
  ],
  "{s14}",
  "bounty_quest_accept_or_deny",
  [
  
  ]
  ],

#module strings
Code:
("job_hunt_army","Yes, I have a job for you! Recently, a wanted criminal has been leading an army of {s8} and has been ravaging the lands arround the village of {s10}. I would like you to bring him here alive, or bring me his head! If you bring me him alive, I'll pay you {reg12}. If you bring me his head, I'll pay you {reg13}."),
 
kalarhan said:
BeefBacon said:
Found a newer version of the mod, from 2016, and used the version of modmerger that it shipped with. No errors, but the changes didn't appear in-game either.

1) When talking about a OSP you should include the link, we can't guess which one you are using
2) You are probably missing steps, like adding the triggers to your mission templates, etc. This should be explained somewhere either on the OSP thread (usually the first post) or on a .txt file with the download

https://forums.taleworlds.com/index.php/topic,34685.0.html

http://www.nexusmods.com/mountandblade/mods/3784/?tab=2&navtag=http%3A%2F%2Fwww.nexusmods.com%2Fmountandblade%2Fajax%2Fmodfiles%2F%3Fid%3D3784&pUp=1

Found it in the Battlefield Tactics Kit OSP thread. First post was last updated in 2008. I downloaded version 5 from 2016, was using version 4 from 2012.

Most of the OSPs that I've looked at seem to have been last updated several years ago. I don't know if they'd even still work - though I see them in other mods so I suppose they must do.

For Formations there's manual installation instructions, but it looks like a massive pain in the arse to do.
 
BeefBacon said:
I downloaded version 5 from 2016

version 5 is from VC and Caribbean! (standalone game), so it is updated with Warband engine (1.170). Did you check the in-game options menu, you need to choose a few flags (including one that enables the formations kit)

also make sure your triggers are being added to the mission template you are using (if you don't know how, compare it using your .txt file). And keep in mind that you may need to add it to other templates as well, depends on your mod.

BeefBacon said:
Most of the OSPs that I've looked at seem to have been last updated several years ago.
12 years of mods, you will need to test and adjust as you go  :mrgreen:



Ramaraunt said:
because the id is well over 50 million!

Code:
(assign, reg1, ":variable"),
(str_store_troop_name, s1, reg1),
(display_message, "@Testing Quest. Target Troop ID: {reg1} | {s1}"),

you can use this template to print out values from variables like ":troop" and test your code execution
 
kalarhan said:
BeefBacon said:
I downloaded version 5 from 2016

version 5 is from VC and Caribbean! (standalone game), so it is updated with Warband engine (1.170). Did you check the in-game options menu, you need to choose a few flags (including one that enables the formations kit)

also make sure your triggers are being added to the mission template you are using (if you don't know how, compare it using your .txt file). And keep in mind that you may need to add it to other templates as well, depends on your mod.

I don't think modmerger is working. No changes to scripts or references to Formations or FormAI as far as I can see. I'm pretty certain I've set it up correctly. In fact I'm using the setting the mod came with, so it should be working. I installed modmerger as instructed, but I don't know if that even worked. If it didn't then I don't know how to make it work.
 
kalarhan said:

Thanks but this is confusing still.

https://gyazo.com/788e4d45e990e7eefd91bd4482394e57

EDIT: is it something wierd with script_get_quest? Does it change the value of the slot at some point?
 
Status
Not open for further replies.
Back
Top Bottom