Updating properties of an updated script upon loading save

Post » Wed Jun 20, 2012 8:00 am

Is there a way to conveniently update the property values of scripts when you load a save from an older version? Or do you really need to unload the mod and the reload it?
User avatar
Nikki Morse
 
Posts: 3494
Joined: Fri Aug 25, 2006 12:08 pm

Post » Wed Jun 20, 2012 5:09 am

Yes.

This is all theory, from here on out.
Thought there may be a workaround. You can detect a version change easily by using two properties, one autoreadonly (actual version) and a standard auto one (used version).
Once detected you can force a reset and thus re-initialize your script and it's properties.

Detecting a version change and notifying the user might be a good idea, regardless.
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Wed Jun 20, 2012 7:26 pm

Yes.

This is all theory, from here on out.
Thought there may be a workaround. You can detect a version change easily by using two properties, one autoreadonly (actual version) and a standard auto one (used version).
Once detected you can force a reset and thus re-initialize your script and it's properties.

Detecting a version change and notifying the user might be a good idea, regardless.
Yes and this means I will have to backup the user's data in the mod before the reset(), which I didn't really feel like doing :/
User avatar
Jack
 
Posts: 3483
Joined: Sat Oct 20, 2007 8:08 am

Post » Wed Jun 20, 2012 6:01 am

You can add a "start game enabled" and "run once" quest that runs a script OnInit that updates the values of properties in another quest/script, then stops itself. It will run once when the update of the mod is first installed.

Best practice is to keep a version number of the mod stored somewhere (a quest property, a global variable) and use that to test whether updates need to be made.
User avatar
alicia hillier
 
Posts: 3387
Joined: Tue Feb 06, 2007 2:57 am


Return to V - Skyrim