Community Forum

XML file deleted when server autosaves

Forum Overview >> Farming Simulator 22

CategoryFarming Simulator 22
Created08.01.2022 19:46

Scott Corio (DumpsterDave) 08.01.2022 19:46
I created a mod that writes data to an XML file in the savegame directory. Everything works fine until the game performs an autosave at which point the XML file created by my mod gets deleted. I've created a workaround where the mod will re-initialize the xml if it's missing and write the data from its data structures to it, but there could be times between the autosave and mods save function where data could be lost if the server is shutdown/restarted in this time period. Is there are specific way to save the XML file so that the game includes it in its saves without deleting it?

Scott Corio (DumpsterDave) 10.01.2022 06:14
Figured it out. Needed to register my save function with the game.

FSBaseMission.saveSavegame = Utils.appendedFunction(FSBaseMission.saveSavegame, MyClass.MySaveFunction)

Note: Log in to post. Create a new account here.