Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Leonion said:
Vatanperver said:
I have a question about module system. Can anybody tell me how to find a list of game engine scripts used in module_scripts.py that are called by call_script? For example script_give_center_to_faction_aux.
Is script_give_center_to_faction_aux an engine script? :???:

In Lav's module system all engine scripts have a comment
This script is called from the game engine
https://forums.taleworlds.com/index.php?topic=324874.0
kalarhan said:
Vatanperver said:
I have a question about module system. Can anybody tell me how to find a list of game engine scripts used in module_scripts.py that are called by call_script? For example script_give_center_to_faction_aux. I can kind of understand what it does but i don't know what it does.

install a decent text editor. I like Sublime Text (free). Notepad++ with explorer plugin. Atom. Python IDE. And so on. You can use a full folder search to locate anything inside all files at the same time. A example: CTRL+SHIFT+F "call_script,"

now: I have no idea what you are trying to say here. Operation "call_script" has nothing to do with "engine scripts". The first is a utility command that you (coder) can use in any file to execute a piece of code from module_scripts.py. The second is a hardcoded system call from the engine, that expects a certain script with a certain name, to do something. Some "engine scripts" are mandatory on the modsys, while others are optional (if you delete them the engine will use a default implementation instead). Like mentioned above all "engine scripts" should be marked with a comment on Lav's modys.

"script_give_center_to_faction_aux" -> there are a bunch of configurations that need to be done to change a center (like a town) from faction A to B. Update notes. Cancel quests. Achievements. AI related decisions. Update farmers. Update the bound centers (think a town with 3 villages). The script has that logic inside it. When you need to give a center to a faction (like after it was conquered on a siege), you can simple call it (and not think about all those bunch of things you need to do to make it happen).

script_give_center_to_faction is the base script. "script_give_center_to_faction_aux" has the "aux" to indicate it is a complementary script for the first.

Thanks for the answers. I am new to modding and module system and i actually don't know much about engine scripts or scripts in general. Not being a native speaker, also doesn't help.

What i tried to ask was where could i learn how to understand what those scripts do, is it written somewhere in module system or game directory and can i read the code it implements?

And also can i define my own scripts and if i can how, in which language, where?
 
Vatanperver said:
And also can i define my own scripts and if i can how, in which language, where?

scripts are re-usable pieces of code. You can call them from other places (trigger, item, mission, even a script). To see their code you can check module_scripts.py.

Easiest way to find a script is to search for the name using quotes like?

script_my_name
look for "my_name"

To learn about MBScript you can check the tutorials. That is the language (Mount and Blade Scripting Language) used on the modsys.

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

and check more tutorials as needed it.

Note: MBScript is not Python. Python is not MBScript. MBScript uses Python. But MBScript is not Python. Learning Python can help you, but it won't matter for coding Warband that much (unless you want to mess with stuff like compiler)
 
kalarhan said:
To learn about MBScript you can check the tutorials. That is the language (Mount and Blade Scripting Language) used on the modsys.

https://forums.taleworlds.com/index.php/topic,240255.0.html
https://forums.taleworlds.com/index.php/topic,142422.0.html
Thanks for the tips and links.
kalarhan said:
Note: MBScript is not Python. Python is not MBScript. MBScript uses Python. But MBScript is not Python. Learning Python can help you, but it won't matter for coding Warband that much (unless you want to mess with stuff like compiler)
That's one of the few things i knew about but thank anyways. :mrgreen:
 
Code:
      (try_begin),
        (eq, "$sneaked_into_town", 1),
        (mission_tpl_entry_set_override_flags, ":mission_template_no", 0, af_override_all),                
        
        (mission_tpl_entry_clear_override_items, ":mission_template_no", 0),
        (mission_tpl_entry_add_override_item, ":mission_template_no", 0, "itm_pilgrim_hood"),
        (mission_tpl_entry_add_override_item, ":mission_template_no", 0, "itm_pilgrim_disguise"),
        (mission_tpl_entry_add_override_item, ":mission_template_no", 0, "itm_sword_medieval_b_small"),
        (mission_tpl_entry_add_override_item, ":mission_template_no", 0, "itm_wooden_shield"),
	(mission_tpl_entry_add_override_item, ":mission_template_no", 0, "itm_two_handed_battle_axe_2"),
      (try_end), 

I changed this part of a "sneak into town/castle" script to give the player new items (short sword, wooden shield, two handed war axe). The staff and throwing daggers are pretty much garbage for most players and makes this extremely infuriating when you take into consideration that enemies will spawn so close to you that you'll have only a second to react before they reach you most of the time.

The problem is that this had no effect on the game. I complied the source code, replaced the old text files with new ones, started a new game and I still got a staff and throwing daggers when I tried to sneak into a town or a castle.

Anyone knows why?
 
Maluxorath said:
I changed this part of a "sneak into town/castle" script to give the player new items

that is related to the prisoner escape mission. See mission_template variable "pilgrim_disguise" to update generic sneaking
Code:
pilgrim_disguise = [itm_pilgrim_hood,itm_pilgrim_disguise,itm_practice_staff, itm_throwing_daggers]
 
The sneak fight mission template overrides are pretty weird, some of them use the aforementioned set, others have items defined for each entry in the mission template (non-combat scenes etc).
 
KnightV said:
can anybody give me workable link for pack realistic textures pack 1.1

I believe that this mod uses them:
http://www.moddb.com/mods/1429-hd-edition-module-complet-2016
 
I am trying to make deploayble pavise herladic.
I managed to get banner in right proportions on it although it is not the right one (player's).
Please help.

  (ti_on_init_scene_prop,
    [
  (store_trigger_param_1, ":instance_no"),
      (scene_prop_set_hit_points, ":instance_no", 100),
      (store_trigger_param_1, ":party_no"),
      (party_get_slot, ":leader_troop", ":party_no", slot_town_lord),
      (try_begin),
          (ge, ":leader_troop", 0),
          (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_1", ":leader_troop"),
      (try_end),
    ]),
   
 
Cigic said:
Code:
(ti_on_init_scene_prop,
    [
	...
      (store_trigger_param_1, ":party_no"),
      (party_get_slot, ":leader_troop", ":party_no", slot_town_lord),
     ....
    ]),
 
how is that part suppose to work? See header_triggers.py for the valid parameters of a trigger.
 
I know it doesn't make sense. I found it somewhere but after lots of tries this was the first iteration that gave result. A banner on prop but not the right banner.

If you know please help.

I was certain that this will work:

  (ti_on_init_scene_prop,
    [
...
      (party_get_slot, ":leader_troop", "p_main_party", slot_town_lord),
      (try_begin),
        (ge, ":leader_troop", 0),
        (cur_scene_prop_set_tableau_material, "tableau_pavise_shield_1", ":leader_troop"),
      (try_end),
    ]),

... but I only get black shield prop
 
Cigic said:
I know it doesn't make sense

post the code you know it works. Things that don't work you can mark it down as the part you were trying something. We have no idea what is in your head, so we can't predict what you know or you don't know that makes sense.

kalarhan said:
how is that part suppose to work?

That was the question. You need to provide further context. What are you trying to do here.

MP or SP
Prop used while visiting a town (a center) or in a battle
Who is the reference for the banner
Is the banner static (always the same and only related to that 1 banner) or dynamic (it needs to change with each town lord, etc)

If all you want is to get the player's reference you don't need to check his party, who is the leader of that party (as you already know who it is). Player is "trp_player". Player party is "p_main_party". The slot "slot_town_lord", as the name suggests, is for a center. Player party is not a center. So it won't work, right?

As suggested by @Somebody you can check tableaus used on Native for the banners as well
 
Hi,
when I add one more game mod to game_multiplayer_admin_panel presentation, screen is freezing. But when I click, sound is playing. Codes that I changed is these:
(try_begin),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),
#        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_wave),#Kortlcha change
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #two more options for these mods (friendly fire options)
        (val_add, ":cur_y", ":cur_y_adder"),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
      (try_end),
      #Kortlcha begin
      (try_begin),
(eq, "$g_multiplayer_is_game_type_captain", 1),
(val_sub, ":cur_y", ":cur_y_adder"), #-2 options but +2
  (try_end),
  (try_begin),
# decrease for removed options in captain coop
    (eq, "$g_multiplayer_game_type", multiplayer_game_type_wave),
(val_sub, ":cur_y", ":cur_y_adder"),
(val_sub, ":cur_y", ":cur_y_adder"),
(val_sub, ":cur_y", ":cur_y_adder"),
  (try_end),
      #Kortlcha end
What is the problem?
 
Leonion said:
whydott said:
Code:
Error: Unable to find object:p_castle_9
ERROR: Illegal Identifier:p_castle_9
Error: Unable to find object:p_castle_21
ERROR: Illegal Identifier:p_castle_21
Error: Unable to find object:p_castle_9
ERROR: Illegal Identifier:p_castle_9
Error: Unable to find object:p_castle_20
ERROR: Illegal Identifier:p_castle_20
Error: Unable to find object:p_castle_21
ERROR: Illegal Identifier:p_castle_21
Error: Unable to find object:p_village_109
ERROR: Illegal Identifier:p_village_109
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
Error: Unable to find object:p_village_109
ERROR: Illegal Identifier:p_village_109
exporting triggers...
exporting dialogs...
Checking global variable usages...
Exporting postfx_params...

______________________________

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

anyone can help?
Obviously, you don't have a bunch of parties: castle_9, castle_21 etc.
And if you think you do, double-check the spelling.
And if the spelling is OK, it's probable that these parties were not yet registered in id_files.
Just recompile your ms again.

Code:
("castle_6","Tilbaut_Castle",icon_castle_c|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(71.423798, 13.122450),[],-0.630068 * (180.0 / 3.1415926)),
  ("castle_7","Sungetche_Castle",icon_castle_snow_a|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-88.830000, -77.940000),[],45),
  ("castle_8","Jeirbe_Castle",icon_castle_c|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(84.759911, 18.949530),[],-1.306401 * (180.0 / 3.1415926)),
  # ("castle_9","Jamiche_Castle",icon_castle_a|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-108.715103, -51.538731),[],100),
  ("castle_10","Alburq_Castle",icon_castle_a|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(80.615387, -25.715490),[],110),
  ("castle_11","Curin_Castle",icon_castle_a|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(93.625160, -35.050228),[],75),
  ("castle_12","Chalbek_Castle",icon_castle_b|pf_castle, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-25.365370, -42.239510),[],95),
This is from the module_parties.py

Code:
p_castle_4 = 48
p_castle_5 = 49
p_castle_6 = 50
p_castle_7 = 51
p_castle_8 = 52
p_castle_10 = 53
p_castle_11 = 54
p_castle_12 = 55
p_castle_13 = 56
this is from the ID_parties.py

yes I don't have (for example) castle_9 but I don't write it in both module_parties.py and ID_parties.py .
It's like "I do it in purpose"
then it should be okay right? why did it error?
 
whydott said:
yes I don't have (for example) castle_9 but I don't write it in both module_parties.py and ID_parties.py .
It's like "I do it in purpose"
then it should be okay right? why did it error?


If you remove castle_9 from module_parties.py, the compiler will object to any code that still refers to it. Search all the files in your module folder for all references to p_castle_9 and remove or change them.
 
Kortlcha said:
Hi,
when I add one more game mod to game_multiplayer_admin_panel presentation, screen is freezing. But when I click, sound is playing. Codes that I changed is these:
(try_begin),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_team_deathmatch),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),
#        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_wave),#Kortlcha change
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #two more options for these mods (friendly fire options)
        (val_add, ":cur_y", ":cur_y_adder"),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
        (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_destroy),
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_siege),
        (val_add, ":cur_y", ":cur_y_adder"), #one more option for these mods
      (try_end),
      #Kortlcha begin
      (try_begin),
(eq, "$g_multiplayer_is_game_type_captain", 1),
(val_sub, ":cur_y", ":cur_y_adder"), #-2 options but +2
  (try_end),
  (try_begin),
# decrease for removed options in captain coop
    (eq, "$g_multiplayer_game_type", multiplayer_game_type_wave),
(val_sub, ":cur_y", ":cur_y_adder"),
(val_sub, ":cur_y", ":cur_y_adder"),
(val_sub, ":cur_y", ":cur_y_adder"),
  (try_end),
      #Kortlcha end
What is the problem?
 
Status
Not open for further replies.
Back
Top Bottom