WarBend is a Python 2.7 package that lets you load Mount & Blade: Warband saves, inspect them, change them, and write them back to disk. It can also export saves as XML, and re-import it back, allowing tools such as XSLT to be used to perform batch updates.
You should probably take a look at WarBender.
It gives full access to all the data stored in a savegame file - every single byte of it. In addition, it provides various convenience features to make that data easy to explore and change programmatically as needed. Here's a simple example to demonstrate what is possible:
from warbend.game.mount_and_blade.native import *
game = load('sg00.sav')
player = game.troops['player']
companions = game.troops['companions']
lords = game.troops['lords']
kings = game.troops['kings']
# All companions ...
for troop in companions:
# ... are very strong.
troop.attributes['strength'] = 20
# ... have maxed-out skills.
troop.skills[:] = [10] * len(troop.skills)
# ... have a masterwork long arming sword.
troop.equipped_items['item_1'].item_kind_id = ID_items.itm_sword_medieval_d_long
troop.equipped_items['item_1'].modifiers = module_items.imod_masterwork
# All lords ...
for troop in lords:
# ... have upstanding personality.
troop.slots['lord_reputation_type'] = module_constants.lrep_upstanding
# ... love the player.
troop.slots['troop_player_relation'] = 100
# ... hate all kings.
for other in kings:
troop.slots[other] = -100
save(game, 'sg01.sav')
Look at samples for more.
-
Packages from requirements.txt:
pip install -r requirements.txt
Since it's a library, it cannot be run directly. However, there are some sample scripts provided to get you started. Here's a step-by-step guide:
-
Back up all your savegames, in case something goes wrong. Do not skip this step!
-
Download the source code for the package, either using Git, or directly as a .zip archive.
-
Download the module system from the link above, then unpack it into the
modules\Native
folder. The resulting directory structure should look like this, whereREADME.md
is this file:📂 ├─📂 modules ⏐ └─📂 Native ⏐ ├─📁 Module_data 1.171 ⏐ └─📁 Module_system 1.171 ├─📁 samples ├─📁 warbend └─📄 README.md
-
Edit
samples\cheat.cmd
. At the minimum, you will need to set the input and the output file names. By default, it will read fromsg00.sav
(the first save slot) in the usual M&B savegame directory underDocuments
, and write the result tosg08.sav
(the last save slot) in the same directory.⚠️ IT WILL OVERWRITE THE OUTPUT SAVEGAME FILE IF IT EXISTS, WITHOUT ANY WARNING! -
Edit
samples\cheat.py
to your taste. -
Run
samples\cheat.cmd
. -
Wait for it to complete (it will take about a minute). If you don't see any errors, load the save from the last save slot and enjoy!