modify magnitude of active magic effect?

Post » Thu Jul 07, 2016 2:35 pm

Is it possible to modify the magnitude of a permanent active magic effect?


I have a magic effect which is permanently in the active effects list, and I have a perk that modifies the magnitude of the effect depending on player actor values. The problem here is that the magnitude only updates at the moment when the magic effect is applied to the player, so even if actor values change, the magnitude of the spell effect does not update unless I use the console to remove and re-add the spell.



How can I solve this?



One idea I have is to add another element (maybe another ability or a script?) which removes and re-casts the other spell effect on the player when appropriate. But I have experimented for hours and have no clue where to even begin.

User avatar
yermom
 
Posts: 3323
Joined: Mon Oct 15, 2007 12:56 pm

Post » Thu Jul 07, 2016 1:55 pm

I finally figured it out. I made a new "dummy" Magic Effect which doesn't do anything except running a script which activates the real ability.


Here's the code I wrote for the dummy magic effect in case anyone else is trying to do something similar:



Scriptname DSM_MysticRechargeScript extends ActiveMagicEffect
{Applies and removes the Magica Regeneration spell to make sure the magnitude updates}

Spell property RegenSpell auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
;Add spell to player, false means don't display notification
akCaster.AddSpell(RegenSpell, false)
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
;remove spell from player
akCaster.RemoveSpell(RegenSpell)
EndEvent

Now all that's needed is to activate and deactivate this dummy spell effect with the proper conditions. I first made the mistake of applying the condition to the magic effect itself, but that was wrong. Instead, the condition should be applied in the spell (which acts as a "constant effect"), so the spell is always active, but the magic effect toggles on and off thanks to the conditions, which in turn activates the script events.

User avatar
David Chambers
 
Posts: 3333
Joined: Fri May 18, 2007 4:30 am


Return to V - Skyrim