Way to get the ActiveMagicEffect ? (no not the magicEffect)

Post » Sat Sep 13, 2014 10:59 pm

so this will not work:

Event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect)
ActiveMagicEffect TheMagicEffect = (akEffect as ActiveMagicEffect)
TheMagicEffect.Dispel()
endevent
Compile error : cannot cast a magiceffect to a activemagiceffect, types are incompatible
However Dispel() will not work for magiceffects !
Is there anyway to get the ActiveMagicEffect that has hit the actor so that I can remove it?
Unfortunately there is no "OnACTIVEMagicEffectApply
I asked a moderator to move this thread to the proper forum section (creation kit). :facepalm:
User avatar
Lil Miss
 
Posts: 3373
Joined: Thu Nov 23, 2006 12:57 pm

Post » Sat Sep 13, 2014 6:42 pm

Try this, it at least compiles for me but I don't know if it works:

Event OnMagicEffectApply(ObjectReference akCaster, MagicEffect akEffect) ActiveMagicEffect TheMagicEffectif TheMagicEffect.GetBaseObject() == akEffectTheMagicEffect.Dispel()endif endevent

Basic idea I guess is it checks if the ActiveMagicEffect is equivalent to the MagicEffect in question, and dispels it if it is.

User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Sat Sep 13, 2014 12:08 pm

ummmmmmmm.... your script will not work because as you have written it ActiveMagicEffect "TheMagicEffect" is not being cast to anything at all. :confused:
But thanks for trying to help, I really do appreciate the effort.
Some how I need ActiveMagicEffect "TheMagicEffect" to be cast to the same ActiveMagicEffect that has been applied to the target actor.
I see no way to get this at all after spending 2 hours in the Wiki.
Think of it this way...ActiveMagicEffect is like a "Reference" of the Base Object "MagicEffect".
The OnMagiceffectApply has NO way of getting the MagicEffect "Reference" that is on the affected actor and that surprises me that Bethesda never set that up considering their Diespel() only works on activemagiceffect "Reference".
User avatar
N Only WhiTe girl
 
Posts: 3353
Joined: Mon Oct 30, 2006 2:30 pm

Post » Sat Sep 13, 2014 10:46 pm

Ah, I see. That is quite an annoyance...

Is this only meant to dispel a single, specified, custom magic effect?

I've looked around, and it sounds like this might be a viable work-around (of course, adjusted to your script): http://forums.nexusmods.com/index.php?/topic/1779985-what-am-i-doing-wrong-with-this-script/?p=15360055

But, that will only work if the magic effect you're trying to dispel has a unique keyword, unless you wanted to dispel a variety of magic effects. It certainly isn't as simple if Beth had just made a way to get ActiveMagicEffects, or made Dispel() work on MagicEffects.

User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am


Return to V - Skyrim