Difference between revisions of "Save Files Notes (Papyrus)"
added "Missing Plugin" under "Properties and Script Variables", summarizing experiments into behavior when loading a save after removing one of its plugins
imported>Ereksen m |
imported>Taleden (added "Missing Plugin" under "Properties and Script Variables", summarizing experiments into behavior when loading a save after removing one of its plugins) |
||
Line 137: | Line 137: | ||
MyVariableWithInit2 = 2 | MyVariableWithInit2 = 2 | ||
MyVariableWithoutInit2 = 0 | MyVariableWithoutInit2 = 0 | ||
===Missing Plugin=== | |||
If a variable, property or array element points to a Form (or any subclass) which is provided by some plugin, and that plugin is removed or disabled between saving and reloading the game, then the variable will not become None but will instead point to a "missing" placeholder form which has ID #0. If the game is saved again at this point and the missing plugin is restored, the variables which became "missing" will nonetheless remain "missing" and will not regain their original values. | |||
<source lang="papyrus"> | |||
Form f = Game.GetFormFromFile(0x123, "Plugin.esp") | |||
Debug.Trace( f == None ) ; false | |||
Debug.Trace( f.GetFormID() ) ; 0x--000123 | |||
Game.SaveGame("save1") | |||
; Plugin.esp is disabled or removed, save1 is loaded, script execution resumes here | |||
Debug.Trace( f == None ) ; false | |||
Debug.Trace( f.GetFormID() ) ; 0 | |||
Debug.Trace( f.GetType() ) ; 0 | |||
Debug.Trace( f.GetName() ) ; "" | |||
Game.SaveGame("save2") | |||
; Plugin.esp is restored, save2 is loaded, script execution resumes here | |||
Debug.Trace( f == None ) ; false | |||
Debug.Trace( f.GetFormID() ) ; 0 | |||
</source> | |||
If two Form variables both become "missing" in this way, they will then evaluate as equal, even if they originally pointed to different forms. Nonetheless, there is no way to set a Form variable to point to the "missing" form without actually removing a plugin; for example, Game.GetForm(0) returns None, not the "missing" placeholder form. | |||
==Functions== | ==Functions== |