Jump to content

Papyrus Remove Magic Effect


phenderix

Recommended Posts

Hey guys I am trying to figure something out.

 

Have not found the solution yet - if one of you guys could help me that would be awesome :D

 

I am trying to use papyrus to remove a magic effect if it already active. I am trying to create a toggable spell.

 

Here is my script thus far:

 

Scriptname SharinganToggle extends ObjectReference

 

Event OnActivate(ObjectReference akActionRef)

if (Game.GetPlayer().HasMagicEffect(ZZSharinganSlowTimeEff))

 

endif

 

EndEvent

 

Any advice or help on solving this issue? Thanks!

Link to comment
Share on other sites

Okay so update on this.

 

I am now doing a much simpler way.

 

I want to make a conditional check on a variable in my script.

 

Anyone know how to reference a variable in a script from a conditional statement?

 

 

 

 

Edit: Ahhh I don't think this will work either.

 

Anyone know how to make toggable spells and/or how to remove a magical effect using papyrus?

 

 

 

 

 

 

 

 

 

 

 

 

Really all I need to get this working is a way to remove a magical effect through a script using papyrus.

Edited by phenderix
Link to comment
Share on other sites

You could try something alone the lines of:

 

if (Game.GetPlayer().HasMagicEffect(ZZSharinganSlowTimeEff))
Game.GetPlayer().DispelSpell(ZZSharinganSlowTimeEff)
	
elseif (!Game.GetPlayer().HasMagicEffect(ZZSharinganSlowTimeEff))
;Add whatever spells etc
endif

 

You could also just use an alse, instead of elseif. In my opinion though, you'd be much batter of creating the effects of the spell you would like to use, instead of calling the predefined spell. Then adding those effects manually in the conditional statement, and removeing them if they're already present on the player.

Edited by kieranh7
Link to comment
Share on other sites

Thanks for your help!

 

However when I try to compile it says my variable, which is the MagicEffectEditorName is not defined. Any solution to this?

 

Find the effects of the spell you're trying to toggle, and add them to the player, manually. This is generally a much more efficient way of doing the toggle spells imo.

 

Try a variation of below, just a quick throw-together script, but it should lead you in the right direction.

 

scriptName ToggleMagicScript extends ActiveMagicEffect
{Scripted effect for the Spell}

import GlobalVariable
SPELL Property YOURSPELLGOESHERE  Auto  
MagicEffect Property MFX  Auto  
GlobalVariable Property MagicTransitionGlobal  Auto  


Event OnEffectStart(Actor akTarget, Actor akCaster)
;Global set to 1
if	(MagicTransitionGlobal.getValue() == 0.0)
	MagicTransitionGlobal.setValue(1.0)
elseif (MagicTransitionGlobal.getValue() == 1.0)
	MagicTransitionGlobal.setValue(2.0)
	self.dispel()
endif
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
if (MagicTransitionGlobal.getValue() == 2.0)
	MagicTransitionGlobal.setValue(0.0)
endif
if (Game.getPlayer().hasMagicEffect(MFX)!=1)
	MagicTransitionGlobal.setValue(0.0)
endif
EndEvent

 

GL with your mod.

Link to comment
Share on other sites

Thanks so much for the help!

 

I will try to get this working and once I do I will put you in the credits for your help with my mod!

 

Thanks again! :D

Edited by phenderix
Link to comment
Share on other sites

  • Recently Browsing   0 members

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