xcafe Posted January 1, 2017 Share Posted January 1, 2017 Ok, here's my script: Scriptname grimoirescript3 extends ObjectReference CentralListScript Property CentralQuest Auto Actor Property PlayerRef Auto Message Property GMSG Auto FormList Property AllSpells Auto Event OnRead() {Begins the studying if conditions are right.} If (PlayerRef.GetSitState() < 3) Debug.Notification("You must be seated to study your grimoire!") Else Int iButton = GMSG.Show() If (iButton == 0) ;yes CloseTheBook() Utility.Wait(0.5) Gotostate("Studying") ElseIf (iButton == 1) ;no Debug.Notification("You decide not to study your spells right now.") EndIf EndIf EndEvent State Studying Event OnBeginState() ;This will run as studying begins. ;;; Include anything that needs to happen at study start here. Int ListSiz = AllSpells.GetSize() Int Inde = 0 While Inde < ListSiz Form Entr = AllSpells.GetAt(Inde) If (Entr as Spell) If (CentralQuest.GrimoireSpellList.Hasform(Entr as Spell)) ; Debug.Notification("Spell Not Known") ElseIf PlayerRef.HasSpell(Entr as Spell) CentralQuest.GrimoireSpellList.Addform(Entr as Spell) PlayerRef.RemoveSpell(Entr as Spell) Else ; Debug.Notification("Spell Not Known") EndIf EndIf Inde += 1 EndWhile Int WaitTime = CentralQuest.GrimoireSpellList.GetSize() Game.DisablePlayerControls(True, True, True, False, True, True, True, True) Game.ForceThirdPerson() Debug.SendAnimationEvent(PlayerRef, "ChairReadingStart") Utility.Wait(WaitTime * 5.0) ; sets when studying will be complete Debug.SendAnimationEvent(PlayerRef, "IdleForceDefaultState") Game.EnablePlayerControls() Int ListSize = CentralQuest.GrimoireSpellList.GetSize() Int Index = 0 While Index < ListSize Form Entry = CentralQuest.GrimoireSpellList.GetAt(Index) If (Entry as Spell) PlayerRef.AddSpell(Entry as Spell) EndIf Index += 1 EndWhile CentralQuest.Gotostate("Grimoire") EndEvent EndState Function CloseTheBook() {Close the book and inventory menu too.} Game.DisablePlayerControls(false, false, false, false, false, true, false, false) Utility.Wait(0.01) Game.EnablePlayerControls(false, false, false, false, false, true, false, False) EndFunction Every part of this script has been proven to work, except for the newest part, which is this: Int ListSiz = AllSpells.GetSize() Int Inde = 0 While Inde < ListSiz Form Entr = AllSpells.GetAt(Inde) If (Entr as Spell) If (CentralQuest.GrimoireSpellList.Hasform(Entr as Spell)) ; Debug.Notification("Spell Not Known") ElseIf PlayerRef.HasSpell(Entr as Spell) CentralQuest.GrimoireSpellList.Addform(Entr as Spell) PlayerRef.RemoveSpell(Entr as Spell) Else ; Debug.Notification("Spell Not Known") EndIf EndIf Inde += 1 EndWhile For some reason, when it gets to this part of the script, the whole thing just stops working, and I can't figure out why. Any ideas? Link to comment Share on other sites More sharing options...
Recommended Posts