[GUIDE] Removing a mod from a save game

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
MegaJohnny
Posts: 2236
Joined: Wed, 4. Jun 08, 22:30
x4

[GUIDE] Removing a mod from a save game

Post by MegaJohnny »

This is a guide for people who'd like to remove "sticky" mods from their save games, allowing them to keep that save game after the mod has been uninstalled. I noticed there wasn't any kind of guide that wasn't extremely terse or basic, so here it is.

Note
Consider the implications of removing a mod from your save game in this manner. When your game loads such a save, it may find that some things don't make sense or that there are references to things that don't exist, and this may cause issues. Pure UI mods are likely fine; AI mods or mission mods will probably cause minor or temporary problems; and major additions like new ships/equipment/sectors really should not be removed on a whim.

Finding the save files
Open the file browser and navigate to this folder in your My Documents folder:

Code: Select all

Egosoft/X4/<numbers>/save
You will see your save games here, with pretty self-explanatory file names. We will probably have to decompress these before we can read them.

Decompressing save files
If your save files have the .xml extension, you can skip this section - but by default (savegame compression is on), they will be .xml.gz files. To compress and decompress save files, I use 7Zip. Extract the file using any appropriate program, so that you now have a .xml file.

Editing the mod out of the save file
You'll notice the save file is extremely large - this is why they have compression on by default. In my experience, Visual Studio Code is a great tool which can read and search through these massive save files without breaking a sweat. Opening the file, look near the first few lines, or do a ctrl+F for the word "patch". You'll see something like the following:

Code: Select all

<patches>
<patch extension="MeJ_Improved_Explore_Behaviour" personal="1" version="51" name="Improved Explore Behaviour"/>
</patches>
We have an XML element here called "patches", which in this case contains one "patch" element. You'll have a "patch" element for each mod that is stuck to the save game. Simply find the one that corresponds to the mod you want to remove, and take it out, then save the file.

You can compress the save file again, if you like. Back up the original .xml.gz file, and then replace it with this one, with whatever program, using the gzip format.

Finishing up and other notes
Now the game should not refuse to load this save.

If it doesn't have any effect, and you have the Steam version of the game, it could be that the cloud sync support in the game is overwriting your changes with the older versions. Consider disabling cloud support for X4 temporarily and repeating the process.
Antaran
Posts: 166
Joined: Wed, 6. Nov 02, 20:31
x3tc

Re: [GUIDE] Removing a mod from a save game

Post by Antaran »

Nice information, you should ask this post to be added to the sticky information post [Index] X4: Foundations Tools, Tutorials and Resources
XTC0R
Posts: 401
Joined: Sat, 1. Dec 18, 19:58
x4

Re: [GUIDE] Removing a mod from a save game

Post by XTC0R »

Thank you for the guide! I was one of the people requesting this on nexusmod for your mod :)
StubbinMyToe
Posts: 1
Joined: Mon, 17. Dec 18, 03:23
x4

Re: [GUIDE] Removing a mod from a save game

Post by StubbinMyToe »

This nolonger appears to work, there is not even a patches tag.

Return to “X4: Foundations - Scripts and Modding”