How do updates work?

Post » Thu Jun 21, 2012 2:50 am

If I do RegisterForSingleUpdate(0.15) in an activemagiceffect script and use OnUpdate() events, will other activemagiceffect scripts attached to other magic effects trigger that OnUpdate event?

For example, I have some actor. I cast Spell A on the actor, which persists for some duration and runs a script that uses OnUpdate() to check some value at certain intervals. While Effect A is active on the target, I cast spell B, which has another script that dispels itself after some time defined in the script, using registerforsingleupdate(Duration) and Event OnUpdate() Dispel() EndEvent.

Will spell B get removed by the updates every 0.15 seconds from spell A? Or are the updates specific to the magic effect, and not the actor?



Also, why do people use DisableNoWait() before using Delete()? And is it possible to call a function on a magic effect script from another magic effect script (I couldn't find a way to retrieve an active effect on an actor as a reference so that I could cast it as a script and call a user defined function in it).
User avatar
Katie Samuel
 
Posts: 3384
Joined: Tue Oct 10, 2006 5:20 am

Post » Thu Jun 21, 2012 2:12 pm

I think the updates are specific to the magic effect.

As a quick test I made a spell with two magic effects of 15s duration. Both magic effects called RegisterForSingleUpdate on starting, then posted a Debug.Notification message and called RegisterForSingleUpdate again in their OnUpdate events, but one was set to do that 5 times and the other twice. And their debug messages showed up 5 times and twice respectively.

Can't help with the other questions, though.
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Thu Jun 21, 2012 5:18 am

the OnUpdate block can only be registered by the script it is contained in.

think of it like a web address, you have many websites that have index.php as the page file, but the full url is different.

likewise in papyrus, even though multiple scripts contain Event OnUpdate(), it really is MyMagicEffectScript.OnUpdate() and MyMagicEffectScript.RegisterForSingleUpdate()

MyOtherSpellScript.RegisterForSingleUpdate() will have no effect on MyMagicEffectScript.OnUpdate(), and can only call the update within its own script.
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm


Return to V - Skyrim