Jump to content

More efficient way to add/remove spells to armors on equip?


Recommended Posts

Posted (edited)

I added lesser powers to certain devious items of the gag variety. I attached it to the zad_effGag magic effect. Is there a more efficient way to add spells to devices be they keyword, spell, armor, etc? Right now this is my current script:

 

 

scriptName DeviousSpellsScript extends ActiveMagicEffect

 

spell property ForcedAnimalSpeak auto
spell property LandtoFap auto
spell property MysteriousGibberish auto

 

Event OnEffectStart(Actor akTarget, Actor akCaster)
    akTarget.AddSpell(ForcedAnimalSpeak, true)
    akTarget.AddSpell(LandtoFap, true)
    akTarget.AddSpell(MysteriousGibberish, true)
EndEvent

 

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.RemoveSpell(ForcedAnimalSpeak)
    akTarget.RemoveSpell(LandtoFap)
    akTarget.RemoveSpell(MysteriousGibberish)
EndEvent

 

I attached it to the zad_effGag magic effect.

 

Also I hope I didn't wander into the wrong thread. I get lost easily.

Edited by Darkpig
Bad naming
Posted
1 hour ago, Arizona_Steve said:

You can use onEquipped(Actor npc) and onUnequipped(Actor npc), attaching both of these events to the item in question. The actor equipping the item is passed in as a parameter.

I'll try but wouldn't the onEquipped Events be ineffective during papyrus calls? Which I assume is one of the methods mods use to equip devices. https://www.creationkit.com/index.php?title=OnEquipped_-_ObjectReference

 

Anyway I am still relatively new to scripting I mainly used this as a template: https://forums.nexusmods.com/index.php?/topic/5372995-need-help-with-script-add-spells-when-armor-is-equipped/

 

Creation Kit didn't like the (Actor npc) thing so I ended up using (Actor akActor) instead. Is that alright?

 

scriptName DeviousSpellsScript extends ObjectReference

spell property ForcedAnimalSpeak auto
spell property LandtoFap auto
spell property MysteriousGibberish auto

Event onEquipped(Actor akActor)
    akActor.AddSpell(ForcedAnimalSpeak)
    akActor.AddSpell(LandtoFap)
    akActor.AddSpell(MysteriousGibberish)
EndEvent

Event OnUnequipped(Actor akActor)
    akActor.RemoveSpell(ForcedAnimalSpeak)
    akActor.RemoveSpell(LandtoFap)
    akActor.RemoveSpell(MysteriousGibberish)
EndEvent

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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