Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
kalarhan said:
you have a error somewhere on your items that is breaking the entire thingy, the compiler is just saying it couldnt load the items list by poiting to the last line. Review your last changes to find your syntax mistake. A easy way to do that is to delete stuff and bring them back in parts to see what breaks where.

Once again, thanks for the info and a quick answer!  :grin:

The issue was that I still had two or three improper placements of ] because of the way I tried to enter faction stings (basically ending the code after item modifier strings).
 
Does anyone have a code to trade with merchant caravans? Doesn't have to be anything fancy, I'm not picky (want it for my pet mod, not to be released publicly, in case anyone wonders), just to trade goods (i.e. not weapons/ armour/ horses).
And another one: does anyone have a code to repair weapons/ armours when talking to weapon/ armour merchants or a completely new npc?

I mean, theoretically, such codes should be easy enough to write on my own, but it's theoretically. Where would I post my experiments for suggestions from the community, in case I do write something? :neutral:
 
One more question, this time of different nature.

Now that I've been testing new items, I encountered a problem with one of my armours.
It seems to be incredibly shiny and I have no idea why.

Here's a screenshot of the armour.
Rq0qhfs.jpg

And these are the related materials and textures.
gZJc9ZI.jpg

2EuPGTK.jpg

Does anyone know why this is happening?
 
Silver Wolf said:
One more question, this time of different nature.

Now that I've been testing new items, I encountered a problem with one of my armours.
It seems to be incredibly shiny and I have no idea why.

Here's a screenshot of the armour.
Rq0qhfs.jpg

And these are the related materials and textures.
gZJc9ZI.jpg

2EuPGTK.jpg

Does anyone know why this is happening?
Worry no more, there is this brand new openbrf tutorial which covers this^^
https://forums.taleworlds.com/index.php/topic,385750.0.html
 
Unfortunately, the problem I have does not seem to be covered in the tutorial.  :neutral:

I'm quite familiar with Open BRF and all of its features, however I've never encountered a problem like this before.
The material and all of its settings are fine (I've checked them 3 times).
The model has no vertex coloring either.

What I'm wondering is could this be caused by a faulty specular and normal map?
 
Silver Wolf said:
Unfortunately, the problem I have does not seem to be covered in the tutorial.  :neutral:

I'm quite familiar with Open BRF and all of its features, however I've never encountered a problem like this before.
The material and all of its settings are fine (I've checked them 3 times).
The model has no vertex coloring either.

What I'm wondering is could this be caused by a faulty specular and normal map?
I would have thought that the section 'Using the Specular Settings' is covering it since I think it's a faulty specular map. Have not enough experience here to give a clear answer though.
 
SupaNinjaMan said:
So I'm using this
Code:
	(troop_get_inventory_capacity, ":player_inventory", "trp_player"),
	(val_sub, ":player_inventory", 9),
	(assign, ":total_items", 0),

        (create_combo_label_overlay, "$g_presentation_obj_admin_panel_19"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_19", pos1),
		(try_for_range, ":item_slot", 10, ":player_inventory"),
			(troop_get_inventory_slot, ":inventory_item", "trp_player", ":item_slot"),
			(neq, ":inventory_item", -1),
			(overlay_set_val, "$g_presentation_obj_admin_panel_19", ":total_items"),
			(assign, reg50, ":inventory_item"),
			(str_store_item_name, s12, ":inventory_item"),
			(overlay_add_item, "$g_presentation_obj_admin_panel_19", s12),
			(val_add, ":total_items", 1),
		(try_end),
to add a button to a presentation that allows you to choose an item that exists in your inventory. This adds the button, but I don't know how to pass the selected item on to the script it's meant to modify. In normal usage where I get to dictate the options I use
Code:
overlay_set_val
to set a variable to tell the script what it's going to be using, but I can't wrap my head around how to make it for something like this.

Does anyone have any pointers for me?

Lol, reading that back I notice I have an overlay_set_val in the loop, buuuut, I also do not know why I put that there. I think that was part of a loop to create a the proper (try_begin), (else_try), loop I would normally expect to use for this sort of thing but forgot to comment it out when it failed me. I cannot be certain, tbh. I wrote this loop moments before going to sleep.

So, in case anyone finds themselves doing something similar, the answer was literally there all along. I used the counter for total items to set up a
Code:
try_for_range
loop to assign the
Code:
overlay_set_val
. Then, using that value, just used the exact same
Code:
troop_get_inventory_slot
I used earlier to determine which item it was based on the value passed along by the button. Then took that item and put it in any old global that would be overwritten when used next time and passed it to the script that needed the item.

Code:
        (assign, ":total_items", 0),
	
        (create_combo_label_overlay, "$g_presentation_obj_admin_panel_19"),
        (overlay_set_position, "$g_presentation_obj_admin_panel_19", pos1),
		(try_for_range, ":item_slot", 10, ":player_inventory"),
			(troop_get_inventory_slot, ":inventory_item", "trp_player", ":item_slot"),
			(neq, ":inventory_item", -1),
			(assign, reg50, ":inventory_item"),
			(str_store_item_name, s12, ":inventory_item"),
			(overlay_add_item, "$g_presentation_obj_admin_panel_19", s12),
			(val_add, ":total_items", 1),
		(try_end),
		
		(assign, reg51, ":total_items"),
		
		(try_for_range, ":add_item", 0, ":total_items"),
			(overlay_set_val, "$g_presentation_obj_admin_panel_19", ":add_item"),
		(try_end),

Code:
        (else_try),
			(eq, ":object", "$g_presentation_obj_admin_panel_19"),
			(try_for_range, ":value_selected", 0, reg51),
				(eq, ":value", ":value_selected"),
				(val_add, ":value", 10),
				(troop_get_inventory_slot, ":selected_item", "trp_player", ":value"),
				(assign, "$g_presentation_obj_admin_panel_30", ":selected_item"),
			(try_end),
        (try_end),
 
Hi guys, I've been getting this error, and cannot for the life of me figure out why:

Unrecognized opcode 2303.; LINE NO: 0:
At Mission Template mst_meeting_merchant trigger no: 10 conditions. At Mission Template mst_meeting_merchant trigger no: 10 conditions.
 
Cozur said:
Hi guys, I've been getting this error, and cannot for the life of me figure out why:

Unrecognized opcode 2303.; LINE NO: 0:
At Mission Template mst_meeting_merchant trigger no: 10 conditions. At Mission Template mst_meeting_merchant trigger no: 10 conditions.
Opcodes are defined in the header_operations.py
That message means you're using an opcode (2303) that isn't defined there.
Look at mst_meeting_merchant at mission templates, 11th trigger, conditions block, 1st line. (Indexes are 0 based, 0 means 1st, 1 means 2nd etc.)
I checked 5 games and WSE and there is no operation with the opcode 2303. You probably passed something like troop or item as opcode accidentally  :smile:
 
I ran into a problem while trying to implement Mordachai's expanded prisoner chat:
http://forums.taleworlds.com/index.php/topic,8652.msg1525822.html#msg1525822

I did everything as described in the post, but when I try to compile the module I got this error:

Loading module... FAILED.
MODULE `dialogs` ERROR:
Traceback (most recent call last):
  File "compile.py", line 135, in <module>
    from module_dialogs import *
  File "C:\Program Files (x86)\Steam\steamapps\common\MountBlade Warband\Modules\TEATRC - Empire in Flames\TEATRC source\module_dialogs.py", line 44131, in <module>
    (try_for_range, ":troop", kingdom_heroes_begin, kingdom_heroes_end),
NameError: name 'kingdom_heroes_begin' is not defined

I've tried replacing it with heroes_begin and heroes_end and the script seems to work.
Does anyone know if the name of the range changed in the newer versions of Warband or Diplomacy for 1.174 and is that going to give me trouble later on?

Also when I say that it seems to work, I mean that it works flawlessly for troops and I also get to free lords or keep them imprisoned, but it can't kill them.
Am I missing some prerequisites to carry out that action?
 
kalarhan said:
check your module_constants.py, constants go there.
make sure your dialog (module_dialogs.py) imports it as well
Code:
from module_constants import *

As always thanks for a quick reply!

I tested it now with the cheats and it seems that the option to kill lords only becomes available when the player becomes a king (or possibly just a lord, but I tested that already).
So the script is fully functional if the kingdom_ prefix is removed from heroes_begin and heroes_end.
 
In my module when i go into a fight, the following error is given
SCRIPT ERROR ON OPCODE 1992: Invalid Mesh ID: 703; LINE NO: 6:
At Tableau Material [4] tab_game_troop_label_banner. At Tableau Material [4] tab_game_troop_label_banner.

in combination with this error the banners above my troops get white like it can't get the banner mesh

Any idea what causes this error/where in the module system i can find this piece of code?
cheers godarcher

it has something to do with
tableau_game_troop_label_banner = 4


i found this part in mission templates

common_battle_init_banner = (
  ti_on_agent_spawn, 0, 0, [],
  [
    (store_trigger_param_1, ":agent_no"),
    (agent_get_troop_id, ":troop_no", ":agent_no"),
    (call_script, "script_troop_agent_set_banner", "tableau_game_troop_label_banner", ":agent_no", ":troop_no"),
(call_script, "script_init_agent_modifiers", ":agent_no"),
])


which leads to

  #script_troop_agent_set_banner
  # INPUT: agent_no
  # OUTPUT: none
  ("troop_agent_set_banner",
    [
      (store_script_param, ":tableau_no",1),
      (store_script_param, ":agent_no", 2),
      (store_script_param, ":troop_no", 3),
      (call_script, "script_agent_troop_get_banner_mesh", ":agent_no", ":troop_no"),
 
  #MOTO bug fix chief
      (try_begin),
          (agent_is_active, ":agent_no"),
      (else_try),
          (call_script, "script_agent_troop_get_banner_mesh", -1, ":troop_no"),
      (try_end),
      (cur_agent_set_banner_tableau_material, ":tableau_no", reg0),
      #MOTO bug fix end
    ]),


which led me to
#script_agent_troop_get_banner_mesh

which i compared to a backup which sees the last lines swapped
          (val_sub, ":banner_spr", banner_scene_props_begin),
          (store_add, ":banner_mesh", ":banner_spr", arms_meshes_begin),

swapped them back

This did the trick, thanks kalarhan for the help :grin:
 
Godarcher said:
Invalid Mesh ID: 703
a bug on your code is trying to use a mesh that doesnt exist (check how many you have on ID_meshes.py)

so track down your code to find where things are breaking (your bug). We have no idea what code you are using, so if you need help with some of it you will need to copy/paste it here.

keep following the code ... open script "script_troop_agent_set_banner", see what it calls, and keep going until you find the call to the tableau and the point of failure.
 
I have one performance related question.

Since I'm planning on using various graphical enhancements I made the game used load_mod_resource so the game can utilize my .brfs instead of Native ones.
I've also removed all the unnecessary materials as well.

So I'm wondering if this is enough for the game to stop loading textures from the main game folder, or do I have to disable that somewhere in module.ini file in order to optimize loading time?
 
Silver Wolf said:
I have one performance related question.

Since I'm planning on using various graphical enhancements I made the game used load_mod_resource so the game can utilize my .brfs instead of Native ones.
I've also removed all the unnecessary materials as well.

So I'm wondering if this is enough for the game to stop loading textures from the main game folder, or do I have to disable that somewhere in module.ini file in order to optimize loading time?

The Warband engine can only load textures referenced in a brf file. Presumably your module.ini has scan_module_textures = 1 to load textures from your mod's texture folder. If so, you only need to make sure all textures are loaded in your module.ini as load_mod_resource. Native Warband loads most of its textures with in this brf: load_resource = textures. If you haven't done so already, you can copy this brf to your mod resources folder, delete references to textures your mod doesn't require and change your module.ini to load_mod_resource = textures.
 
Thank you for the clarification!  :grin:

Oh I did exactly that, I was just wondering if the game loads any of it's Native textures not present in the .brf files.
It's probably just the sheer amount of textures then that's making the loading time a bit longer than expected.
 
I'm fixing some bugs at a module which is not coded by me,
however i'm kinda stuck with one,
When i start the game my seventh faction (of 32) has war declared by all other factions.

so 1: i checked the factions relations in module_factions, nothing crazy there

2: i searched faction_7 troughout the module system, no strange codes tho

3: i followed the faction creation tutorial to check if something is missing but also nothing seems wrong

My best shot at this moment i think would be to manually just set the relations back to what they should be on the script game start

My question is if anybody happens to know if there is a script to manipulate faction relations, as i can only seem to find scripts to manipulate player faction relations

Edit: thanks for your help guys i happened to finally find a script which does exactly what i wanted, its kind of a lazy solution, but well its better then nothing


added at the end of script game_start
Code:
	  (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
		(neq, ":cur_faction", "fac_kingdom_7"),
		(call_script, "script_diplomacy_start_peace_between_kingdoms", "fac_kingdom_7", ":cur_faction", 0),
	  (try_end),

Edit 2: Hmmm this seems to put my faction at truce with all other factions

Code:
            (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
		(neq, ":cur_faction", "fac_kingdom_7"), #Faction found not Roman Gallia
		(assign, ":kingdom_a", "fac_kingdom_7"),
		(assign, ":kingdom_b", ":cur_faction"),
		(store_relation, ":relation", ":kingdom_a", ":kingdom_b"),
		(val_max, ":relation", 0),
		(set_relation, ":kingdom_a", ":kingdom_b", ":relation"),
		(call_script, "script_exchange_prisoners_between_factions", ":kingdom_a", ":kingdom_b"),

                (try_for_range, ":cur_center", centers_begin, centers_end),
			(store_faction_of_party, ":faction_no", ":cur_center"),
			(this_or_next|eq, ":faction_no", ":kingdom_a"),
			(eq, ":faction_no", ":kingdom_b"),        
			(party_get_slot, ":besieger_party", ":cur_center", slot_center_is_besieged_by),
			(ge, ":besieger_party", 0), #town is under siege
			(party_is_active, ":besieger_party"),        
			(store_faction_of_party, ":besieger_party_faction_no", ":besieger_party"),
			(this_or_next|eq, ":besieger_party_faction_no", ":kingdom_a"),
			(eq, ":besieger_party_faction_no", ":kingdom_b"),
			(call_script, "script_lift_siege", ":cur_center", 0),
		(try_end),
	  
		(call_script, "script_event_kingdom_make_peace_with_kingdom", ":kingdom_a", ":kingdom_b"), #cancels quests
		(call_script, "script_event_kingdom_make_peace_with_kingdom", ":kingdom_b", ":kingdom_a"), #cancels quests
	  (try_end),

EDIt 3: This did the trick, thanks for the help :grin:
 
Status
Not open for further replies.
Back
Top Bottom