Question on Script Variables and Savegames

Post » Wed Jun 20, 2012 6:48 am

Hey there, I couldn't find an answer to this in the Wiki. How are the values of variables handled for running scripts when the game is saved/the game session ended?

Are they lost/returned to default or are they actually stored when the game is saved?
User avatar
Nymph
 
Posts: 3487
Joined: Thu Sep 21, 2006 1:17 pm

Post » Wed Jun 20, 2012 5:45 am

Variable values are stored. Here's some clarification from a developer:
Your properties and variables will always save their values for as long as the instance of the script exists and isn’t reset. For a repeatable quest, you’ll keep everything until the quest is started up. If it’s on a reference, you’ll keep everything until your cell resets (if the reference is flagged to reset). If it’s on an active magic effect, you’ll keep everything while the effect is applied to its target (after that the script instance is deleted as soon as you stop doing things with it). For more information on resetting, you should take a look at http://www.creationkit.com/OnReset_-_ObjectReference#Notes.

Any variables you define inside a function will be discarded as soon as you leave the function, similarly to most other scripting and programming languages.

Cipscis
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Wed Jun 20, 2012 3:32 am

Thanks for that. That's actually good news as it means I should be able to do my newest experiment relying on papyrus and the CK only without any need for SD or SKSE.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am


Return to V - Skyrim