I'm trying to make a testing spell that adds every spell in a formlist to the player when cast. I created a formlist named OMZspellList in the CK and dragged all my spells into it. I was hoping some sort of while loop or onupdate loop would be able to add all the spells to my character. My issue is that my debug notifications are telling me that my list is empty even though I know it shouldn't be.
Scriptname PLZWORK1 extends ActiveMagicEffect Actor Property playerREF AutoFormlist Property OMZspellList AutoSpell Property spellREF AutoSpell[] Property OMZspells Auto ; OMZspell, OMZspell1, OMZspell2, OMZspell3, OMZspell4Event OnEffectStart(actor akTarget, actor akCaster)playerREF = Game.GetPlayer()OMZspells = New Spell[100]Int IndexA = OMZspellList.GetSize()Debug.Notification("IndexA: " + IndexA) ; returns 0While IndexA > 0 IndexA -=1 OMZspells[IndexA] = OMZspellList.GetAt(IndexA) as spell ; trying to fill array Debug.Notification("IndexA: " + IndexA)endWhileInt IndexB = OMZspellList.GetSize()Debug.Notification("IndexB: " + IndexB)While IndexB > 0 IndexB -= 1 spellREF = OMZspells[IndexB] playerREF.AddSpell(spellREF) ; trying to add spells in while loop Debug.Notification("IndexB: " + IndexB)endWhileRegisterForSingleUpdate(1.0)endEventEvent OnUpdate() ; this entire section is redundant, hoping for something to workInt IndexCspellREF = OMZspells[IndexC] ; trying arrayplayerREF.AddSpell(spellREF)spellREF = OMZspellList.GetAt(IndexC) as spell ; trying list even though it is redundant playerREF.AddSpell(spellREF)IndexC += 1Debug.Notification("IndexC: " + IndexC)Debug.Notification("OMZspellListSize: " + OMZspellList.GetSize()) ; reports 0 even though the list is populated in CKIf IndexC <= OMZspellList.GetSize() RegisterForSingleUpdate(1.0)endIfendEvent
A lot of that script is just me trying to learn how things work. I don't need arrays in there, although I would like to see how to get them to work.