Difference between revisions of "Save Files Notes (Papyrus)"

Removed assertion that FormList entries for removed Forms will be relocated based on testing in 1.5.97.
imported>Taleden
m (added FormLists section)
(Removed assertion that FormList entries for removed Forms will be relocated based on testing in 1.5.97.)
 
(5 intermediate revisions by 3 users not shown)
Line 20: Line 20:


===Removing===
===Removing===
If you remove a property or variable after a save was made, that property or variable's value in the save game will be discarded, and a warning will be printed to the script log detailing what happened.
If you remove a property or variable after a save was made, that property or variable's value in the save game will be inaccessible to running scripts{{Verify|Are we sure that Papyrus scripts can't manually query the values of orphaned properties on other script instances?}}, and a warning will be printed to the script log detailing what happened.
 
The property will be removed from the saved data the next time the user saves. Papyrus warnings should not be generated again after that initial save.


===Changing===
===Changing===
Line 241: Line 243:


==FormLists==
==FormLists==
If entries are added to a FormList by a script, and the game is saved and reloaded, then the additional entries will be restored from the save file. If the FormList is modified in the Creation Kit between saving and loading, then those modifications will also take effect: after reloading the save, the FormList will contain all elements specified in the CK as of loading (not as of saving), followed by all elements which had previously been added by scripts (as of saving). If the FormList's length is changed in the CK, this implies that script-added entries will have different indecies after reloading than they did when saving. A FormList's Revert() method discards all script-added entries from the list, including entries added during a previous play session which were then restored from a save file.
<source lang="papyrus">
; FormList Property fl Auto
; Form Property Dragonstone Auto
; CK defines fl = [Torch, Lockpick]
Debug.Trace( fl.GetSize() ) ; 2
Debug.Trace( fl.GetAt(0) ) ; Torch
Debug.Trace( fl.GetAt(1) ) ; Lockpick
Debug.Trace( fl.GetAt(2) ) ; None
fl.AddForm(Dragonstone)
Debug.Trace( fl.GetSize() ) ; 3
Debug.Trace( fl.GetAt(2) ) ; Dragonstone
Game.SaveGame("save1")
; CK redefines fl = [Lockpick, IronOre, IronIngot] ; save1 is loaded, script execution resumes here
Debug.Trace( fl.GetSize() ) ; 4
Debug.Trace( fl.GetAt(0) ) ; Lockpick
Debug.Trace( fl.GetAt(1) ) ; IronOre
Debug.Trace( fl.GetAt(2) ) ; IronIngot
Debug.Trace( fl.GetAt(3) ) ; Dragonstone
</source>


===Missing Plugin===
If a form which is provided by some plugin is added to a FormList by a script, and that plugin is removed or disabled between saving and reloading the game, then the affected entries in the FormList will not be removed, but will instead be changed to None and may be moved within the list. If the game is saved again at this point and the missing plugin is restored, the FormList entries which became None will nonetheless remain None and will not be removed. A FormList's Revert() method will still remove these missing entries, however, just as it removes all script-added entries.
<source lang="papyrus">
; FormList Property fl Auto
; Form Property Dragonstone Auto
; CK defines fl = [Torch, Lockpick]
Debug.Trace( fl.GetSize() ) ; 2
fl.AddForm(Game.GetFormFromFile(0x123, "Plugin.esp"))
fl.AddForm(Dragonstone)
Debug.Trace( fl.GetSize() ) ; 4
Debug.Trace( fl.GetAt(0) ) ; Torch
Debug.Trace( fl.GetAt(1) ) ; Lockpick
Debug.Trace( fl.GetAt(2) ) ; PluginItem0x123
Debug.Trace( fl.GetAt(3) ) ; Dragonstone
Game.SaveGame("save1")
; Plugin.esp is disabled or removed, save1 is loaded, script execution resumes here
Debug.Trace( fl.GetSize() ) ; 4
Debug.Trace( fl.GetAt(0) ) ; None
Debug.Trace( fl.GetAt(1) ) ; Torch
Debug.Trace( fl.GetAt(2) ) ; Lockpick
Debug.Trace( fl.GetAt(3) ) ; Dragonstone
Game.SaveGame("save2")
; Plugin.esp is restored, save2 is loaded, script execution resumes here
Debug.Trace( fl.GetAt(0) ) ; None
Debug.Trace( fl.GetAt(1) ) ; Torch
Debug.Trace( fl.GetAt(2) ) ; Lockpick
Debug.Trace( fl.GetAt(3) ) ; Dragonstone
</source>
There is no way to add None to a FormList without actually removing a plugin; the CK does not offer None as a drag-and-drop option, and FormList.AddForm(None) has no effect. Similarly, FormList.HasForm(None) and FormList.Find(None) will always return False and -1, respectively, even if there are None-entries at the beginning of the list as a result of a missing plugin.


{{Languages}}
{{Languages}}
[[Category: Papyrus]]
[[Category: Papyrus]]
6

edits