Jump to content

Help needed: Toggelable Mage Armors with Mage Armor Perk


Recommended Posts

I've been working on a little addon that makes some spells a toggle.

I've managed to make spells toggleable but the problem arises when the Mage Armor perk gets involved as it uses different magic effects.

 

My question is how do I enable the Mage Armor perks to apply and remove when an armor spell is toggled?

 

It seems it always applies when the spell is cast and I've managed to create a script that checks the togglemagearmorglobal if it's a specific number and else dispell the effect (script down below for those that are interested).

 

Status so far:

Candlelight - Working

WaterBreathing - Working

Flame Cloak - Working

Frost Cloak - Working

Lightning Cloak - Working

Muffle - Working

Invisibility - Working

Mage Armors - Working

Mage Armor Perk - Not Working

 

What I did:

Create global in Miscellaneous/Global

Add script togglespell to magiceffect

Add properties

 

example:

togglespellglobal - GlobalVariable - togglemagearmorglobal

togglespelleffect - MagicEffect - ArmorFFSelf0

 

Other Info:

The Mage Armors spells (Oakflesh and such) all use togglemagearmorglobal as their togglespellglobal

 

Scripts:

togglespell - added to the magiceffects of Oak-, Stone-, Iron- and Ebonyflesh.

import GlobalVariable

Event OnEffectStart(Actor akTarget, Actor akCaster)
       if      (togglespellglobal.getValue() == 0.0)
               togglespellglobal.setValue(1.0)
       elseif (togglespellglobal.getValue() == 1.0)
               togglespellglobal.setValue(2.0)
               self.dispel()
       endif
EndEvent

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

MagicEffect Property togglespelleffect  Auto
GlobalVariable Property togglespellglobal  Auto

 

togglespellperk - added to the magiceffects of the Mage Armor Perk.

import GlobalVariable 

Event OnEffectStart(Actor akTarget, Actor akCaster) 
       if      (togglespellglobal.getValue() != 1.0) 
               self.dispel() 
       endif 
EndEvent 

GlobalVariable Property togglespellglobal  Auto  

Link to comment
Share on other sites

  • Recently Browsing   0 members

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