I won’t be teaching you the scripting language of Warband here, this is a guide to help with your understanding of compiled module because unfortunately, Pendor devs won’t provide us with source files of module system and known decompilers don’t decompile the module into compilable form so we have to make do with .txt files. You can still use decompiled pendor files for reference though.
The tweaking is done through editing .txt files that are located at …/MountBlade Warband/Modules/*ModName*. Obviously you need a txt files editor, Notepad++ is really great and recommended.
If you need help understanding the module system, try here: https://forums.taleworlds.com/index.php/board,171.0.html
Module System and .txt files
All txt files but 4 are compiled from module system .py files that share the same name but with module_ in the beginning. The 4 exception are:
- item_kinds1.txt is compiled from module_items
- menus.txt is compiled from module_game_menus
- conversation.txt is compiled from module_dialogs
- dialog_states.txt is compiled from module_dialogs
Once you open some .txt files, you will mostly see numbers inside. Every number has its meaning and here I will describe the types of numbers that are applicable to every .txt file that we will be working with. They are:
- Operation codes - they are given constants, and each of these numbers mean a certain operation. You can look them up in header_operations.py. The most important ones are:
- neg (negate) - 2147483648
- this_or_next - 1073741824
- le (less than or equal to) - 2147483680
- lt (less than) - 2147483678
- Variables - There are many types of them:
- Global Variables – 144115188075855871 + № of variable from variables.txt (line number in Notepad++)
- Local Variables – 1224979098644774912, 1224979098644774913, etc, etc.
- Registers – 72057594037927936 (reg0), 72057594037927937 (reg1), etc, etc.
- Scripts – 936748722493063168 + № of a script from scripts.txt (script number = (line-3)/2 in Notepad++)
- Menus - 864691128455135232 + № of a menu from menus.txt (menu number = (line-3)/2 in Notepad++)
- Items - 288230376151711744 + № of an item from item_kinds1.txt (entry number in Morgh's Editor)
- Troops – 360287970189639680 + № of a troop from troops.txt (entry number in Morgh's Editor)
- Factions – 432345564227567616 + № of a faction from factions.txt (entry number in Morgh's Editor)
- Parties – 648518346341351424 + № of a party from parties.txt (entry number in Morgh's Editor)
- Party templates - 576460752303423488 + № of a template from party_templates.txt (entry number in Morgh's Editor)
- Strings - 216172782113783805 + № of a string from strings.txt (line number in Notepad++)
- Quick strings - 1585267068834414592 + № of a string from quick_strings.txt (line-2 in Notepad++)
- Quests - 504403158265495552 + № of a quest from quests.txt (line-3 in Notepad++)
- Dialogue state ID numbers - № of a dialogue ID from dialog_states.txt (line-1 in Notepad++), used in conversation.txt (the numbers before 2 space characters)
- Conversation operands - № of an operand from conversation.txt (the first number after "dlga_..." strings). They either represent troops (mostly NPCs until ~1200) or actual conversation operands like 4095 (anyone else) and 69631 (the player), deciding which side is currently speaking. When updating a conversation tweak to a newer mod version, the offset of the last troop in troops.txt has to be applied to these operands as well, except for 4095 and 69631 (as those are static).
- Sounds - 1152921504606846976 (cannot be specified with one formula!)
- Scene props - 1080863910568919040 (cannot be specified with one formula!)
- Particles - 1008806316530991104 + № of a particle from particle_systems.txt (particle number = (line-3)/8 in Notepad++)
- Presentations - 1513209474796486656 (cannot be specified with one formula!)
- Music - 1657324662872342528 + № of a music from music.txt (line-2 in Notepad++)
- Animations (actions.txt) - 1801439850948198400 (cannot be specified with one formula!)
- Mission templates - 792633534417207296 (cannot be specified with one formula!)
- Scenes - 720575940379279360 + № of a scene from scenes.txt (scene number = (line-3)/4 in Notepad++)
- Meshes - 1441151880758558720 + № of a mesh from meshes.txt (line-2 in Notepad++)
- Tableau materials - 1729382256910270467 + № of a tableau material from tableau_materials.txt (line-2 in Notepad++)
General structure of scripts in .txt files
First number is one that describes the number of operations in script, after it begins the operation that generally consists of:
- Operation code
- Number that describes an amount of variables in operation.
- Variables code
At the very top of simple_triggers file is a number that describes an amount of simple triggers in it. They consist of a period in hours which describes how often they are triggered. After it begins a script.
In dialog_states.txt listed all states of dialogs. To add a new one you need to do it at the bottom of it. In conversations.txt the lines consist of:
- Current dialogue state
- Next dialogue state
- Number that describes who is talking, most common ones are 69631 for MC and 4095 for anyone else.
- № of current dialogue from dialog_states.txt
- Script that acts as availability check for dialogue option. 0 if it’s always available.
- Dialogue text
- № of next dialogue from dialog_states.txt
- Script for consequences of choosing this option
- String that describes sound file playing during conversation, NO_VOICEOVER for nothing.