Jump to content

Event on Spell Added?


xcafe

Recommended Posts

So I have this script, meant to activate an event when it's added to the player, but no dice. Any advice?

 

 

 

Scriptname grimoire24script extends MagicEffect
Form Property GrimoireSpellList Auto
CentralListScript Property CentralQuest Auto
Actor Property PlayerRef Auto


Event OnEffectStart()
Debug.Notification("Effect Started")
RegisterForSingleUpdateGameTime(24.0)
Debug.Notification("Effect Started, Registered")
EndEvent

Event OnUpdateGameTime()
Debug.Notification("Removespells Called")
Int ListSize = CentralQuest.GrimoireSpellList.GetSize()
Int Index = 0
While Index < ListSize
Form Entry = CentralQuest.GrimoireSpellList.GetAt(Index)
If (Entry as Spell)
PlayerRef.RemoveSpell(Entry as Spell)
EndIf
Index += 1
EndWhile
Debug.Notification("Spells Removed")
EndEvent

 

 

 

P.S. The debugs aren't going off or anything either.

Link to comment
Share on other sites

What is the duration of the magic effect? If the magic effect is removed before the update event is called, the registration for the single update is automatically cleared (as far as I understand the wiki). Try making sure that the magic effect lasts longer than the time period you wish to wait.

 

Alternatively, put that central quest script to work for you and call a function on it which registers for the update and performs all the necessary work there.

Link to comment
Share on other sites

So I'm trying the quest thing, but what event do I use to trigger the register? I can't think of a way to do it short of checking for a variable with OnUpdate, but leaving that on like that would cause major save bloating.

 

EDIT: I tried doing the thing with variable and OnUpdate for now, and it works, but I'm still concerned it'll cause save bloating.

Edited by xcafe
Link to comment
Share on other sites

I was simply thinking that you would put a function similar to this on your quest script:

Function RegisterForMyStuff()
  RegisterForSingleUpdateGameTime(24.0)
EndFunction

Then the OnUpdateGameTime event with all the stuff you want to do.

 

On the magic effect script where you already have the quest script linked, you'd simply do:

Event OnEffectStart()
  Debug.Notification("Effect Started")
  CentralQuest.RegisterForMyStuff()
  Debug.Notification("Effect Started, Registered")
EndEvent

I don't see where you'd get save bloating from that...

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...