Prior to my current attempt the script would add the item, but then I would be unable to save the game (CTD), or upon loading the game, the added item disappeared from the leveled list. In English: I add a book to a leveled list that is sold by a merchant, the script runs, book is there. I save, reload, book is not there.
However today, I created 2 test spell tomes, and wrote this:
Scriptname zzAddToFormTestQuestScript extends Quest LeveledItem Property LItemSpellTomes25AllAlteration Auto LeveledItem Property LItemSpellTomes00AllSpells Auto Book Property zzTestSpellTome1 Auto Book Property zzTestSpellTome2 Auto Quest Property zzAddToFormTestQuest AutoEvent onInit() RegisterForSingleUpdate(60)endEventEvent onUpdate() LItemSpellTomes00AllSpells.AddForm (zzTestSpellTome1, 1, 1) LItemSpellTomes25AllAlteration.AddForm (zzTestSpellTome2, 1, 1) debug.MessageBox ("Tomes added, go check.")zzAddToFormTestQuest.Stop()endEvent
When I loaded the game, the script ran. I CoC'd to Dragonsreach and checked Farengar's inventory, and found the books in it. I then saved, quit the game, reloaded, and checked the inventory again - the books were still there. I bought them, saved, waited for 48 hours, and the books respawned!
I also checked that the quest was not running after it finished the first time (getquestrunning zzAddToFormTestQuestScript returned 0).
So it seems that AddForm is persistent now? This should be a pretty big deal for those adding new items via mods, to enable conflict-free integration. Can someone confirm? Preferably someone who is better at Papyrus than me?