How to ensure stored mod data persists between saves?

Post » Wed Dec 17, 2014 3:32 pm

I know from reading CK.com and my own experience that mod data will generally persist between saves as you would expect it to (ie, global variables, properties, objects, etc). However, I'm trying to get a better understanding of what exactly causes the game to see something as "new", and subsequently re-initialize it (thereby erasing any previously saved mod data). It seems like this is something most mods would have to address at some point, and it doesn't seem to be an issue most of the time, but it makes me nervous when I don't fully understand what's going on behind the scenes.

My concern is this: I'm planning a large update to my mod that will rely very heavily on storing certain information in global arrays in the background (the arrays are in a script attached to a quest object). This stored data will need to persist and be available throughout the entirety of the playthrough. If the script is ever re-initialized for whatever reason, there will be no way to retroactively load the previously stored data. This would be very frustrating to users of the mod, especially if they have a large save that's been accumulating data all throughout the playthrough. Basically, I need to make sure I avoid sabotaging my own mod by doing something that will cause everything to reset.

Let's say someone uses the mod and the mod accumulates some saved data. When I subsequently release an update to the mod, how can I ensure that the game will not decide to initialize everything from scratch? In other words, how does the game determine that it's looking at the same thing that's already in the save file? Is it just based on the plugin name, quest ID, and script name matching what's already in the save?

User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Return to V - Skyrim