Jump to content

Firing a script when the player has a magic effect applied (or actor value change)


Recommended Posts

Hi!

I'm currently working on this mod and I'm trying to optimize a specific section of my code.

My mod needs to be able to reliably track max actor value changes (notably Health, Stamina and Magicka), and preferably in real-time. My current implementation simply polls the player's actor values every few seconds. I'd like to improve that, like by having an event listener when a magic effect is applied and when you change your equipped items. I already handle equipment changes, but I haven't found a way to handle magic effects being applied.

So, in a nutshell, here's my question: Is there a way to fire a script when any magic effect is applied on the player, OR, is there a way to fire an event every time a max actor value has changed?

Thanks.

Edited by BSoD38
Link to comment
Share on other sites

On 2/2/2024 at 10:04 PM, xkkmEl said:

Thanks for the pointer! It's a step in the right direction, but I'm still stuck on what I'm trying to do.
Basically, I want to trigger some function when a magic effect is applied, but also when it is removed. Sadly, there is no OnMagicEffectRemoved event, so I tried writing a workaround to find the duration of the magic effect attached, but it seems that you cannot get the applied MagicEffect's duration, and you cannot find which Spell the MagicEffect was attached to, which would allow me to get the duration.

I wonder if what I'm trying to do is even possible. I'll stick with periodic polling for now I think.

Edited by BSoD38
Link to comment
Share on other sites

  • Recently Browsing   0 members

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