This script works the first time only

Post » Tue Feb 24, 2015 1:34 am

So this script is meant to be attached to a shrine giving the player a spell once a day and when activated. It works fine for the first time only.

Spoiler
Scriptname myscript extends ObjectReference

Actor Property PlayerRef Auto
Spell Property DLC2SacredStoneSpell Auto
Spell Property UniqueSpell Auto
GlobalVariable Property GameDaysPassed Auto
GlobalVariable Property AllMakerStoneRecharge Auto
Message Property DLC2StandingStoneNotReadyMsg Auto
Sound Property DLC2StoneActivateSound Auto

Auto State Active

Event OnActivate(ObjectReference akActionRef)
DLC2StoneActivateSound.play(self)
DLC2SacredStoneSpell.Cast(akActionRef)
Game.GetPlayer().AddSpell(UniqueSpell)
GoToState("Inactive")

EndEvent

EndState

State Inactive

Event OnActivate(ObjectReference akActionRef)
If GameDaysPassed.Value < AllMakerStoneRecharge.Value
DLC2StandingStoneNotReadyMsg.Show()
else
GoToState("Active")

EndIf

EndEvent

EndState


I think I'm missing something like OnUpdate or something similar...but what to put and where baffles me. Help, please.
User avatar
Amanda Leis
 
Posts: 3518
Joined: Sun Dec 24, 2006 1:57 am

Return to V - Skyrim