I've got this script set up:
Scriptname CYRAyleidWellScript Extends ObjectReference{This would be placed on the activator, the well} Spell Property AyleidAbility Auto{Fill this property with your spell in the CK}ObjectReference Property EnableMarker Auto{Point this to an xmarkerheading that is an Enable Parent of your sound emitter and effect model, with opposite enable states UNCHECKED}Actor Property PlayerREF Auto{The player, should autofill}GlobalVariable Property GameHour Auto{Should autofill, the current game hour}Sound Property AyleidWellActivate Auto{How long the ability should last} Auto State Ready Event OnBeginState() EnableMarker.Enable(true); false if you want it to pop in, not fade in EndEvent Event OnActivate(ObjectReference akActionRef) PlayerREF.AddSpell(AyleidAbility, true); false if you don't want to notify the player of the spell adding AyleidWellActivate.Play(Self) GoToState("Waiting") EndEvent Event OnUpdateGameTime() EndEvent Event OnUpdate() EndEvent EndState State Waiting Event OnActivate(ObjectReference akActionRef) EndEvent Event OnBeginState() EnableMarker.Disable(true); false if you want it to pop out, not fade out Self.Disable(true) RegisterForSingleUpdateGameTimeAt(0.0); midnight EndEvent Event OnUpdateGameTime() Self.Enable(true) GoToState("Ready") EndEvent EndState Function RegisterForSingleUpdateGameTimeAt(float GameTime){Registers for a single UpdateGameTime event at the next occurrenceof the specified GameTime (in hours since midnight)} float CurrentTime = GetCurrentHourOfDay() If (GameTime < CurrentTime) GameTime += 24 EndIf RegisterForSingleUpdateGameTime(GameTime - CurrentTime) EndFunction float Function GetCurrentHourOfDay() global{Returns the current time of day in hours since midnight} float Time = Utility.GetCurrentGameTime() Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit Time *= 24 ; Convert from fraction of a day to number of hours Return Time EndFunction
Which sort of works. All of the properties are filled correctly, BUT:
The spell is only ever added the first time.
Can anyone tell what's wrong with the script?