Save Game Editor / Convertor

Users who are viewing this thread

kushulain

Recruit
MnB SaveGame Editor / Converter, is a tool which let you edit save game and convert from a mod's version to another. (Yes, you can now get your old character you stopped to play because of mod updates !)
I cannot guarantee 100% success of conversion though. It depends on the settings you choose via the program and how big the update.

So far it worked great with :
-A Clash Of Kings, converting saves from 1.0 to 1.11
-Anno Domini 1257, converting saves from 0.97 to 1.03 (without faction slots settings enabled)

Download Link
Sources

Screenshot
ScreenShot.jpg

How the program works
In order to display correct value stored in the save game, this program uses a "SaveGameStructure.txt" which describes save game structure and "SlotsNames.txt" which helps giving names to slots.
They also tell how the value should be converted, there are different possible behaviours :

    DONTREPLACE = 0 e.g. num_triggers :eek:
    REPLACE = 1 e.g. Player's Level
    CLEAR = 2 e.g. game log

    DONTREPLACE_EXCEPTPLAYERS = 3, e.g. troops faces
    REPLACE_EXCEPTPLAYERS = 4, .

These next ones try to find new IDs. If the IDs number changed, but the name remains the same, the program will find and replace with new ID number.
If the new version's ID's name is missing (troop or faction is deleted by the update) then the value is not replaced.

    REPLACE_BY_FACTION_ID
    REPLACE_BY_GLOBALVAR_ID
    REPLACE_BY_PARTY_ID
    REPLACE_BY_PARTY_TEMPLATE_ID
    REPLACE_BY_PARTY_RECORD_ID
    REPLACE_BY_QUEST_ID
    REPLACE_BY_SCENE_ID
    REPLACE_BY_TROOP_ID
    REPLACE_BY_ITEM_ID


IDs are gathered from Modules files while the save is loaded.
"SlotsNames" came from Warband module system's file "module_constants.py". This file may differ from mod to mod.
It often looks like Native's one, but having mod's "module_constants.py" would help a lot, and make things safer.

Editing "SaveGameStructure.txt" and "SlotsNames.txt" is really not recommended. But I admit I wasn't sure which behaviour to give to some entries sometimes.

Convert a save game to another mod's version
You need the save and mod installed, and also the new version of the mod installed, with a random save game as example. (just start a new game and save it)

-Load the save you wish to convert.
-Load the example save from the recent mod version.
-Click 'Convert Save...'
-Select the two saves, and check all the data you wish to convert. The less is checked the less bugs you may encounter. But going with default settings should do it well.
-Click "Export Current Save" and choose a output file. (Please, watch out to not to override your current saves)

Modify a save game
-Click "Import new save..."
-Select Module directory and a savegame. Then click load.
-Modify some values
-Click "Export Current Save" and choose a output file.

You cannot add entries, only modify. And you may not modify variables with "num_" in the name.
Insure your values are coherents.
If you wish to modify player's party troop_ids, insure you replace heroes by heroes or non-heroes by non-heroes troops.
Otherwise the final file may be corrupted. I hope this limitation to be removed in later versions.

Known Bugs :
-crashes if program exceed about 1.7 GB in RAM (so loading more than 2 save is not advised)
-loading progress not correct
-modifying "num_" variables corrupt save game
-modifying player troops / player_party_stack_additional_info may cause file to be corrupted.

If you find any bugs your are welcome to share them.
As same for any feedback, help needed etc.

Thanks to cmpxchg8b, he did a really good job finding out save game structure.

Enjoy,
and please, do not abuse this program :smile:
Kushulain.

Edit : I've just noticed there was already a save tool being developped here We should have worked together. >< This is sad, MnB will have to save tool now.
 
So we don't have to start a new game just to test our codes either?

Not really, because my program require that you have a save from the new mod version. So you must have started a new game anyway.
I've never done M&B mods myself, but this program may be handy, in the case you want access to any game variables. Changing troops, global variables, relation, slots etc.
 
When version 1.3 comes out for clash of kings, will I be able to convert from 1.2?

Yes. It should do the job. Some features are not convertibles yet (i would need help to know which they are exactly). But most of your game will be : your character, item, troops, cities you own, enterprises etc... So you will have to experiment yourself, and see if you didn't loose something important from your old save. And contact me if you do.

Remember you will need the two (1.2 & 1.3) version installed on your computer to do the transfer. And also 2 game saves : from the version 1.2, and a newly started game from 1.3.
 
One question:

I have a save on which I play with no quitting without saving. I want to change it to allow me to quit without saving. Can I change this using this editor?
 
I have a save on which I play with no quitting without saving. I want to change it to allow me to quit without saving. Can I change this using this editor?

Yes you can do that.

Load it with the program, and change the variable save_mode from 1 to 0. (it's the 4th entry in the list)
Save it back (with a different name would be safe).
 
I started a rebellion and after taking all the towns most of the lords that didn't side with me just joined other factions. This pretty much dooms my faction to die forever wasting all my hard work destabilizing a king.

Is there any way to put the original lords (Swadians) back to their "proper" faction (Swadian Rebels)?
 
We can change Lord's and Party's faction for sure, but i haven't tried myself, don't know if it will work well.

I think you should change the faction value here :
-party_records/-Lord name-'s Party/party/faction_id
-troops/trp_knight_x_x_Lords_name/faction_id

for each lords.

There are also some other value about faction, but i don't think they are important :
-troop/trp_..../slots/slot_troop_original_faction (14)
-troop/trp_..../slots/slot_troop_change_to_faction (55)

Tell me if you manage to do what you want ! Finding all the lords party will be a bit tricky as there is no search function and they seems disordered.
Good luck !
 
So far it's not really working like I'd hoped. If I just change the faction ID in the party_records they get the correct color on the map, but if I talk to them they still act like hostiles and raid my towns etc.

If I change their faction in both the party_records and the troop slot then they start acting like they actually belong to my faction. If I talk to them though they still call themselves whatever they were before (eg. Jarl Devlain instead of Lord Devlain). This would be fine...

However, my game refuses to save anymore. It just give an error:
Error: Unable to save game!!!!!

Is there maybe something else I'm overlooking?
 
Sorry I can't help you more with it.
About the game unable to save, you simply need to close the savegame editor, it prevents the game from saving.
 
derp, now that I closed the editor the game saves fine.

I suppose I'll see if it works. Thanks for your help!
 
how can i add troops to the players party?

i want to "cheat" two heroes into my party, because they dissapeared due to bug
 
BananaBob said:
how can i add troops to the players party?

i want to "cheat" two heroes into my party, because they dissapeared due to bug

Yes, but unfortunately, you can't really add troops, only replace heroes units by heroes units, and non-heroes by non-heroes.
It means you need to visit taverns, hire 2 random heroes, save your game. Then :

Open your save,
Go to party_records/#0PlayerName/party/stacks/
In stacks, you will see all the stacks of your party (troop_id and num_troops)
You will need to change the 2 newly hired heroes troop_id by a new hero's ID you want.
To know which ID belong to who, Browse the existing troop_id in : troops/The_ID/  (all the player's party heroes are following in the list)
Save under a different name. (Even back up your old save if you are unsure)

(if you replace a non-hero by a hero and vice versa, the save won't load in game)
 
thanks alot!  and great work :grin:

will the heroes whom i replaced spawn in a tavern, just as usuall or are they now in the same nirvana were the other 2 heroes were?
 
>< Didn't think of that.

After a little look the modules sources. I've been able to understand how companions works a little.
https://www.taleworlds.com/en/Games/Warband/Download

If you want to expect to meet a companion in a tavern, its slots (found in troops/trp_npcID (194-209 for native)/slots/) must be set to these values :

slot_troop_days_on_mission#150 : 0          (actually named slot_troop_controversy in the save editor)
slot_troop_occupation#2 : 0                        (0 : not in player's party, 5 : in player's party , 11 : retirement)
slot_troop_prisoner_of_party#8  <= 0 (-1)

About your bugged companions you can first ensure these values are like the ones above.
But you can even know in which city/party (party_records) they are, looking at these slots :

slot_troop_cur_center#12  (party_records_ID)
slot_troop_prisoner_of_party#8  (party_records_ID)

And even set slot_troop_cur_center yourself, to a city ID which contains a tavern. To force the meeting.

There is also this value, but it's only used for dialog i think :

slot_troop_playerparty_history#82 : 0-4

1 : scattered
2 : dismissed
3 : quit
4 : indeterminate

If you don't managed to meet your bugged companions, you can do as a said before, hire 2 random companions and replace the IDs. And then, set the random companions slots values to normal, in order to avoid them to lay in nirvana as you say. (slot_troop_days_on_mission=0 , slot_troop_occupation=0, slot_troop_prisoner_of_party=-1)
Add the ones bugged you added (slot_troop_occupation=5)

I think all this should work. Good luck !
 
Back
Top Bottom