Help with "ActiveEffect.Dispel()"

Post » Mon May 13, 2013 8:41 pm

Hey.

So I made an enchantment for some armor. In my script I have to use the SetAV command to manually apply the effect and remove it. However, once the armor is removed, the effect is still persistent.

So, I went through the process and tried using the above command as seen here: http://www.creationkit.com/Dispel_-_ActiveMagicEffect

However, when I adapt it to my effect, it comes back with errors.

For property I have: MagicEffect Property HelloEffect Auto

and then for the actual script I have: HelloEffectActiveEffect.Dispel() just like the link says, but it comes back with : "variable HelloEffectActiveEffect is undefined"

Anyone have any ideas?

User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Tue May 14, 2013 3:05 am

Post your full script please :smile:, seems like you may have other issues going on.

A MagicEffect and an ActiveMagicEffect are two different things. A MagicEffect refers the generic effect which you created. The ActiveMagicEffect refers to the specific instance on the player.

HelloEffectActiveEffect is undefined because you didn't define it as a property or variable (adding ActiveEffect onto your magic effect property doesn't do anything). To refer to the ActiveMagicEffect in the script, use the "self" variable. So Self.Dispel() or simply Dispel(). You don't need the MagicEffect Property.

Since you have an enchantment though, it should automatically dispel when you unequip it so Dispel() is not needed. Also, don't use SetAV. ModAV is much safer so you can return the AV back down to its original value. Also... can't you just make your enchantment a "Value Modifier" and adjust the AV that way instead of using a script. Anyways, your script should look something like this...

Scriptname testaaa extends ActiveMagicEffectEvent OnEffectStart(Actor akTarget, Actor akCaster)    akTarget.ModAV("Health", 50.0) ;increases the wearers health by 50endEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)    akTarget.ModAV("Health", -50.0) ;returns the health to normalendEvent
User avatar
Hannah Whitlock
 
Posts: 3485
Joined: Sat Oct 07, 2006 12:21 am

Post » Tue May 14, 2013 5:47 am

Here's the actual script:

Scriptname Invisitest2222 extends activemagiceffect  Armor Property Roi  Auto  Actor Property PlayerRef  Auto   Event OnEffectStart(Actor Aktarget, Actor AkCaster)	If PlayerRef.IsEquipped(Roi) == True	PlayerRef.ModAV("Invisibility", 100)endifendeventEvent OnEffectFinished(Actor Aktarget, Actor AkCaster)	If PlayerRef.IsEquipped(Roi) == False	PlayerRef.ModAV("Invisibility", -100)endIfendevent

The problem is when I remove the ring, the invisibility effect/shader persists. I checked active effects though, and confirmed that I am not invisible. But the visual effect is still there.

I looked into the visual effects properties, but nothing with invisibility that I could see.

User avatar
Sarah Kim
 
Posts: 3407
Joined: Tue Aug 29, 2006 2:24 pm

Post » Tue May 14, 2013 7:32 am

One way I see around that is setting the player's alpha back to 1.

PlayerRef.SetAlpha(1)

You are probably better off using the invisibility archetype in the magic effect.

User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am


Return to V - Skyrim