A guide for editing/adjusting your gameplay through the .txt files. This is not a complete and thorough examination of the whole text, it mostly focuses on the basics. If you have any problems or need any help, leave a comment and I'll do my best to reply. We'll go through troops.txt, parties.txt, scenes.txt and item_kinds1.txt.
2
1
В избранное В избранном Поделиться Этот предмет добавлен в избранное. GingyAjax3,136 | уникальных посетителей |
55 | добавили в избранное |
A guide for editing/adjusting your gameplay through the .txt files. This is not a complete and thorough examination of the whole text, it mostly focuses on the basics. If you have any problems or need any help, leave a comment and I'll do my best to reply.
This guide focuses on the Native module's .txt files. The methods shown will be the same for most mods however, you'll probably need to figure out the item/troop ids and other values that the mod might change.
It's not necessary, but to make things easier, I'd recommend downloading the Module System [forums.taleworlds.com] . It can help you find out what the numbers in the text files mean. If you're looking to make a lot of changes, then the module system is your best bet. Some mods even offer their module systems that you can build off of. If you only want to make changes to the .txt files, there's tools that can help with that e.g. Morghs Editor [forums.taleworlds.com] , TweakMB [forums.taleworlds.com]
To find the ids/indices of troops and items, you can use this line of javascript as a bookmark on your search engine e.g. chrome etc. Create a bookmark/star and paste the code into the url input. Then click the bookmark on any website.
javascript: void(() =>Can't fit more text in those sections
Additional Troop Info [drive.google.com]
Additional Item Info [drive.google.com]
These can also be found in 'ID_*.py' files, in the module system
Native Troop ID's [drive.google.com]
Native Item ID's [drive.google.com]
We'll look at the Swadian Militia block of text
If you add or remove troops, make sure to change the number (of troops) at the top of the file, below 'troopsfile version 2'
trp_swadian_militia Swadian_Militia Swadian_Militia 0 36700160 0 0 15 37 40 155 0 376 0 377 0 468 0 555 0 518 0 248 0 247 0 308 0 308 0 170 0 165 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 7 5 4 4 9 75 75 75 75 75 75 0 274 131072 0 1 0 0 17179869185 1315051091194281984 1835136 0 50465891015 7916447985573822463 2031036 0
(Unique for each troop, so no duplicates)I've linked a list of Native troop IDs above. To find out troop ids for a mod, I've set up a javascript bookmarklet that you can use.
Troop Name (Other troops can have the same name)155 0 376 0 377 0 468 0 555 0 518 0 248 0 247 0 308 0 308 0 170 0 165 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0
Each number above 0 is and item id/index. After each item index, there's a 0 which is used as a separator. A -1 means an empty slot in the inventory, replace one of these to add a new item
Attributes & Level7 5 4 4 9
7 (Strength) 5 (Agility) 4 (Intelligence) 4 (Charisma)
And the level of the character is here
7 5 4 4 9
75 75 75 75 75 75 0
(1 Handed Wep) (2 Handed Wep) (Polearms) (Archery) (Crossbows) (Throwing) (Firearms)
trp_npc9 Alayen Alayen 0 268435472 0 0 1 0 0 242 0 171 0 436 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 11 8 7 8 2 100 100 100 100 100 100 0 16 268566528 0 12563 77824 0 12901691407 5304496236943751379 1950433 0 0 0 0 0
Each number/decimal is a set of skills.
These make Alayen into a powerhouse with 10 in all skills
If we take the first number/decimal 2684357290 and plug it into a decimal to hexadecimal converter [www.rapidtables.com] , you'll get a hex value of A0000AAA with each digit signifying a skill.
To get each skill set, go into skills.txt. Then going down the list, separate the skills into groups of 8 and then reverse each group of skills.
If we go into the Native module's skills.txt file. The order of skills goes like:
trade, leadership, prisoner, reserved_1, res_2, res_3, res_4, persuasion
We reverse the set so that persuasion is first and trade last.
Looking at the hex value of A0000AAA. Persuasion is the first A (10), the reserved skills don't have a number and the other skills are also A (10)
If we want leadership to be 6 instead of 10, we change A0000AAA to A0000A6A
When you're done, convert the new hex (A0000A6A) value back to decimal (2684357226)
Face Codes 17179869185 1315051091194281984 1835136 0 50465891015 7916447985573822463 2031036 0Each 4 numbers represent one face code. To create a custom face, start up Warband and in the configuration menu go to advanced and enable edit mode.
Then go to multiplayer and edit your character. When you have a face that you like, press Ctrl + E. Click the large hexadecimal value on the top left to copy it or CTRL+C
You'll get something like this
From RIGHT to LEFT, split the hex number into 4 sets of up to 16 digits. Then go to a hex to decimal converter [www.rapidtables.com] and convert each hex value into a decimal value
Hex - [000000018200250c] [23036ab922b2c58e] [00000000001d295d] [0000000000000000]
Decimal - [6476014860] [2522977559641245070] [1911133] [0]
We'll be using the Practice Sword's text block
If you add or remove items, make sure to change the number (of items) at the top of the file, below 'itemsfile version 3'
itm_practice_sword Practice_Sword Practice_Sword 1 practice_sword 0 12976130 9223388529554358287 3 0 1.500000 100 0 0 0 0 22528 103 0 90 0 532 534 0 0
(Unique, no duplicates)Flags, Capabilities and Modifiers are covered in additional item info (linked above) as there's no space left in section.
itm_practice_sword Practice_Sword Practice_Sword 1 practice_sword 0 12976130 9223388529554358287 3 0 1.500000
How common it is in shops/lootEach Damage Modifier is split up into three category's, Cutting, Piercing and Blunt. There is a 256 gap between each modifier. So it's 1-256 for cutting, 257-512 for piercing and 513-768 for blunt.
The damage for this weapon is 19 (532) blunt damage for swinging and 21 (534) blunt damage for thrusting.
Thrust Damage See swing damageThat sell this item. It is the second line.
If the number is greater than 0, the next line will list the faction ids/indices, else the line won't show up.
The Charger horse has 2 factions that sell it, Swadia and Rhodoks
itm_charger Charger Charger 1 charger_new 0 65537 0 1811 110595670016 0.000000 40 0 58 0 4 165 44 40 112 0 32 0 2 15 19 0
Number of TriggersIf the number is greater than 0. The next line will consist of trigger/script blocks.
The Old Round Shield has 1 trigger.
itm_tab_shield_round_a Old_Round_Shield Old_Round_Shield 1 tableau_shield_round_5 0 327687 5100273664 26 167772194 2.500000 100 0 4 0 0 195 93 0 50 0 0 0 0 1 -50.000000 3 2071 1 1224979098644774912 2072 1 1224979098644774913 1 4 936748722493063579 1729382256910270473 1224979098644774912 1224979098644774913
Items: Adding New EntriesThere's plenty of free resources on the forums that you can add to your mod.
OpenBRF is the go to tool for viewing .brf files, which are the files the game uses to hold graphical data (meshes, animations etc).
Let's add a new itemI'm going to use this [forums.taleworlds.com] resource pack for this section.
When you've downloaded the one you want, throw all of the .dds image files inside your mods 'Textures' folder and the .brf files into the 'Resource' folder.
Some .brf files will hold one mesh, but multiple meshes can be inside one .brf file. Which makes it easier when loading them in 'module.ini' and for organisation.
In your mod folder, open 'module.ini' with notepad or your text editor. Then make sure 'scan_module_textures' is equal to 1 not 0.
Still in 'module.ini', near the load_resource lines. Input 'load_mod_resource = the_brf_file_name' for each .brf file you've added.
. load_resource = object_bodies load_mod_resource = men_at_arms load_mod_resource = men_at_arms_lods load_resource = goods_meshes .
In my copy of Native's 'item_kinds1.txt' file, I'm going to find 'itm_mail_hauberk' and copy and paste the item block at the end of the file.
itm_mail_hauberk Mail_Hauberk Mail_Hauberk 1 hauberk_a_new 0 16842765 0 1320 704643236 19.000000 100 0 40 12 7 0 0 0 0 0 0 0 0 0
Make to sure add to the item count at top of the file, below 'itemsfile version 3'
In OpenBRF, the mesh names can be found in the left side panel
If you can't or don't want to use OpenBRF, you'll need to go through the .brf file to search for the mesh name. Or they might provide the mesh names on the download page.
When you have your mesh name. Change 'hauberk_a_new' to your mesh. The '0' after the mesh name is for the mesh modifiers. In native, there's 3 mesh modifiers. These can be found in 'header_items.py' in the module system.
ixmesh_inventory = 0x1000000000000000 # Show a different mesh in the inventory ixmesh_flying_ammo = 0x2000000000000000 # Ammunition mesh. Search for 'itm_tutorial_arrows' in 'item_kinds1.txt' ixmesh_carry = 0x3000000000000000 # For stuff like javelins bags on your back, or dart pouches. Search for 'itm_practice_javelin'
Change the id and any other values that you want. Then get the item index, if you've added a new item at the bottom of 'item_kinds1.txt' you can take the item count at the top of the file and to get the index subtract 1.
To see it in action, go into 'troops.txt' and replace a '-1' with the item index in a troop's inventory.
trp_watchman Watchman Watchmen 0 36700160 0 0 1 28 31 155 0 376 0 377 0 434 0 468 0 555 0 556 0 507 0 508 0 248 0 250 0 317 0 313 0 325 0 171 0 165 0 620 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 0 -1 7 5 4 4 9 .
Make a backup of parties.txt and scenes.txt just in case
Let's make a scene. Go into parties.txt in your module folder. We'll be using the village Mechin.
1 100 100 p_village_10 Mechin 2114575 0 0 3 0 0 0 0 0 8.800000 34.750000 8.800000 34.750000 8.800000 34.750000 0.0 0 2.967060
Now start up Warband and in the inital window, go into configuration and tick 'Video -> Start Windowed' and also 'Advanced -> Enable Edit Mode'
When you're on the world map, next to the'Camp' button, there should be a 'Terrain' button. Fiddle around with the options and then when you're happy with the result copy the hexadecimal value up top.
With the terrain's hex value, go into scenes.txt and find village_10. 10 being the number for the village of Mechin in parties.txt
scn_village_10 village_10 256 none none 0.000000 0.000000 100.000000 100.000000 -100.000000 0x000000013005dad40005f57b0000543e0000279d000052b4 0 0 outer_terrain_plain
scn_village_10 village_10 256 none none 0.000000 0.000000 100.000000 100.000000 -100.000000 0x000000013005dad40005f57b0000543e0000279d000052b4
Once you've done that, go into the SceneObj folder in the module folder and delete 'scn_village_10.sco' (Best make a backup).
Start the game back up and go to Mechin. Visit the village center. Once you're on the map, hit 'CTRL + E' and start editing. When you save your changes, it will either update the scene file or a new .sco file should pop up in the SceneObj folder
For a more in depth tutorial of scene making check these out:
Nordous' Sceners Guild [forums.taleworlds.com]
Hiner's Tutorial [forums.taleworlds.com]
Yldrania's Tutorial [forums.taleworlds.com]
I won't be going through the basics of scripts in this section as I'm not that familiar with it myself. I'll leave a link to this [forums.taleworlds.com] guide which goes into much more detail than I could. That guide focuses on the module system. Which is what you'll need to use, even if you only want to edit 'scripts.txt', since you'll be cross-referencing a lot. You don't need to read the whole thing. Read chapter 4 (Module Syntax & Usage) and then you should have a basic understanding of how scripts work.
Mods might not offer their module system for you to compile yourself, so to change some things around, you'll need to look in the .txt files. And because the m&b modding scene is quiet, most mods are not getting regular updates if any. Meaning if you want to modify a mod's features, you might only need to trawl through the compiled text that one time. If you're subscribed to mods on steam, you might want to disable auto-updates, as it will overwrite any changes you make.
I'd also recommend a feature rich text editor e.g. Notepad++, VSCode, for editing the .txt files
The general layout for a script goes as follows:
[id], [-1, if the 2nd arg is not an array then this will be the second arg, and the operation line will use the 3rd arg] [num of statements] [[statements]]
Opcodes and most other values can be found in the 'header_*.py' files inside the module system. header_operations.py for the opcodes.
Some Operands inside the .txt files use offsets/shifted to the left. This link [pop3.fandom.com] shows all of the numbers to look for.
Compilation of tweaks [forums.taleworlds.com] (Some scripts might be outdated)
If you add or remove any scripts, make sure to change the number (of scripts) below 'scriptsfile version 1' at the top of the file.
Scripts are made up of statements. Same for triggers; which have their own files, but you'll also see them used in other files. Statement blocks are used as conditional blocks as well. I'll leave a link [drive.google.com] to the structure of the .txt files
You'll probably want to enable debug messages. To do this, in config on start up 'Enable Cheats'. Then when you're in game, 'CTRL + ¬' on windows to open the cmd line. Type 'cheatmenu' and then go into 'Camp' -> 'CHEATMENU' and set debug messages to all (It might be default). To disable cheat menu, type 'nocheatmenu' in the cmd line.
This example was taken from Prophecy of Pendor's 'scripts.txt'
sell_all_prisoners -1 13 2133 2 1224979098644774912 0 1651 2 1224979098644774913 648518346341351424 7 3 1224979098644774914 0 1224979098644774913 1656 3 1224979098644774915 648518346341351424 1224979098644774914 2147485155 1 1224979098644774915 1657 3 1224979098644774916 648518346341351424 1224979098644774914 1 2 936748722493063192 1224979098644774915 2107 2 72057594037927936 1224979098644774916 2105 2 1224979098644774912 72057594037927936 1616 3 648518346341351424 1224979098644774915 1224979098644774916 3 0 1 3 936748722493063628 360287970189639680 1224979098644774912 2133 2 72057594037927936 1224979098644774912
13 - Number of statements
2133 - assign opcode
2 - takes in 2 arguments
1224979098644774912 - Local variable
0 - value of 0
1651 - party_get_num_prisoner_stacks opcode
2 - num args
1224979098644774913 - local var
648518346341351424 - party index, player's party index is 0;
7 - try_for_range_backwards opcode
any try_* opcodes will add a level to the depth, and then to go up a level you'll use 'try_end'. There's no graceful error handling, to exit the try. It either needs to pass successfully or it will fail and move to an 'else_try', which is used to catch errors I believe.
3 - num of args try_for_range_backwards takes
1224979098644774914 - a local variable to act as a counter
0 - Lower bound. When the counter is equal to this, it exits the try loop
1224979098644774913 - Prev declared local var that holds the prisoner_stacks
These blocks are inside the try loop
1656 - party_prisoner_stack_get_troop_id opcode
3 - num args
1224979098644774915 - local var to hold the troop id
648518346341351424 - party index, player's party
1224979098644774914 - it uses the try loops counter var as the stack number index
2147485155 - is troop not hero, 0x80000000 is the negate opcode, 2147485155 gives us a hex value of 0x800005E3. 0x5E3 is 1507. 1507 in 'header_operations.py' is the 'troop_is_hero' opcode, which takes in a troop id to check
1 - num of args
1224979098644774915 - the troop id inside a local var
1657 - party_prisoner_stack_get_size opcode
3 - num args
1224979098644774916 - local var to hold stack size
648518346341351424 - player's party
1224979098644774914 - try loops counter, used as the stack index
1 - call_script opcode
2 - num args
936748722493063192 - script identifier. 936748722493063168 + script index in 'scripts.txt'. Inside PoP's scripts.txt, I'll use a text editor like VSCode for line numbers on the side. Go to line (24 * 2) + 2 top lines and we land on the 'game_get_prisoner_price' script. 'game_get_prisoner_price' assigns the ransom price to reg0.
1224979098644774915 - prev local var that holds troop id.
2107 - val_mul opcode. Multiplies 2 numbers and assigns the value back to the first param. Which in this case goes back to reg0
2 - num args
72057594037927936 - register identifiers + reg index. We're looking for reg0
1224979098644774916 - previously declared local var that holds stack size
2105 - val_add opcode
2 - num args
1224979098644774912 - prev local var, which was assigned 0 at the start.
72057594037927936 - reg0 identifier
1616 - party_remove_prisoners opcode
3 - num args
648518346341351424 - player's party ident
1224979098644774915 - prev local var, troop id
1224979098644774916 - stack size, inputting full stack size as amount to remove
3 - try_end opcode. We go back up a depth level now. All local vars declared in the previous level can't be accessed.
0 - num args
1 - call_script
3 - num args, call_script includes the params of the script it's calling as its own.
936748722493063628 - script identifier for 'troop_add_gold'
360287970189639680 - troop identifier, 360287970189639680 + troop index. Index 0 for the player
1224979098644774912 - local var for total ransom profit
2133 - assign opcode
2 - num args
72057594037927936 - reg0 identifier
1224979098644774912 - total ransom local var
And here's what it'll look like in the Module System
('sell_all_prisoners', [ (assign, ':total_ransom' 0), (party_get_num_prisoner_stacks, ':num_prisoner_stacks', 'p_main_party'), (try_for_range_backwards, ':stack_index', 0, ':num_prisoner_stacks'), (party_prisoner_stack_get_troop_id, ':troop_id', 'p_main_party', ':stack_index'), (neg|troop_is_hero, ':troop_id'), (party_prisoner_stack_get_size, ':stack_size', 'p_main_party', ':stack_index'), (call_script, 'script_game_get_prisoner_price', ':troop_id'), (val_mul, reg0, ':stack_size'), (val_add, ':total_ransom', reg0), (party_remove_prisoners, 'p_main_party', :troop_id, ':stack_size'), (try_end), (call_script, 'script_troop_add_gold', 'trp_player', ':total_ransom'), (assign, reg0, ':total_ransom') ] ),
To see where the script is being used. Get the script's index, that's 690 for 'sell_all_prisoners', then add it to 936748722493063168 and we'll get 936748722493063858.
To see if it's being used anywhere, search for that number in pretty much most of the files in the mod (PoP) folder. To make life a bit easier, some text editors let you search an entire folder for a search term. If you're using VSCode on Windows, you can open the module folder and hit CTRL + SHIFT + F to search the entire folder
When we search for 936748722493063858 in the files, we'll see that it's being used in 'conversations.txt' for the ransom brokers and named ransom brokers
This is what we find
dlga_ransom_broker_sell_prisoners_all:ransom_broker_sell_prisoners_2 4095 1207 0 Let_me_see_what_you_have. 1222 1 1 1 936748722493063858 NO_VOICEOVER
Scripts: Sell All PrisonersFollowing up from the previous section.
Let's add it to another mod; I'll use a copy of Native.
When you paste the script, the script's identifier will be different, because the script is in a different 'scripts.txt' file so it will have a new index. Get the index and add it to 936748722493063168. In my case that's 610 + 936748722493063168 = 936748722493063778. Replace 936748722493063858 in the dialog lines below, with the new identifier.
There's also script identifiers in the 'sell_all_prisoners' text that might need to be changed.
Copy the 'sell_all_prisoners' script text block above and paste it at the end of 'scripts.txt' in your mod folder.
Add 1 to the number at the top of the file, below 'scriptsfile version 1'
Then go to 'conversations.txt' and paste the 2 dialog lines below. If you want the dialog option when talking to a ransom broker 'I want to sell my prisoners', to be higher than the other options, paste that line before them in 'conversations.txt'.
dlga_ransom_broker_talk:ransom_broker_sell_prisoners_all 69631 1200 2 2159 1 72057594037927936 30 2 72057594037927936 1 I_want_to_sell_all_my_prisoners. 1207 0 NO_VOICEOVER dlga_ransom_broker_sell_prisoners_all:ransom_broker_sell_prisoners_2 4095 1207 0 Let_me_see_what_you_have. 1222 1 1 1 936748722493063858 NO_VOICEOVER
Make sure to add or subtract to the count at the top of the file, below 'dialogsfile version 2'.
We also need to add 'ransom_broker_sell_prisoners_all' inside 'dialog_states.txt', under 'ransom_broker_sell_prisoners'
And we need to change the starting and ending dialog state tokens. If you search for 'dlga_start:ransom_broker_talk' in your mods 'conversations.txt' file. You should see '4095 0' after the id. The 0 is the 'start' dialog state index in 'dialog_states.txt'. After the dialog text, you'll see the ending state index, copy that.
Change '1200' in 'dlga_ransom_broker_talk:ransom_broker_sell_prisoners_all 69631 1200' to the ending dialog state index from 'dlga_start:ransom_broker_talk'. Then copy the ending state that's further down the line and paste that as the opening state for the 'dlga_ransom_broker_sell_prisoners_all:ransom_broker_sell_prisoners_2' line.
When you go talk to a ransom broker now, the option 'I want to sell all my prisoners' should pop up, if you have prisoners.