Script Help, Compiles but doesn't work

Post » Mon Aug 19, 2013 9:46 pm

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.

Spoiler
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.

User avatar
TASTY TRACY
 
Posts: 3282
Joined: Thu Jun 22, 2006 7:11 pm

Post » Mon Aug 19, 2013 6:38 pm

This

Int IndexA = OMZspellList.GetSize()

returns 0, right?

I know this will sound stupid, but did you fill your property with your formlist in the CK and are you sure you are testing with a clean save? I mean, its pretty basic to define a list and see if that list is empty or not.

User avatar
Scared humanity
 
Posts: 3470
Joined: Tue Oct 16, 2007 3:41 am


Return to V - Skyrim