Please Need Help with Spell Toggle Script!!!!

  • Welcome to Skyrim Forums! Register now to participate using the 'Sign Up' button on the right. You may now register with your Facebook or Steam account!

Artemiss Rose

New Member
Hi

I'm new to modding so far ive spent the past 6months just learning everything there is to know about it before actually attempting one for myself. But here I am and here I'm stuck.

I'm trying to get a togglable spelltome to work where it will add the spell to player as well as remove the spell from the player.

I can get this script to compile and when I enter game to test I can learn the spell on activation and get the message but then when I click on the activator again to remove the spell nothing happens...

Does anyone have any suggestions on what I can do ? could really use the help I have no Idea why its not working it should work in theory but I'm clearly missing something or not doing something right. ive been messing with it for over a week its driving me insane lol

thanks
-Artemiss



Scriptname SpellTome_Script extends ObjectReference
; Toggle spells on player

Spell Property YourSpell Auto
ObjectReference Property LinkedRef auto
int Property myStatus auto



Event OnActivate(ObjectReference akActionRef)

If Game.GetPlayer().HasSpell(YourSpell) == true
GoToState("SpellRemoved")
Else Game.GetPlayer().HasSpell(YourSpell) == false
GoToState("SpellAdded")
EndIf

EndEvent

State SpellAdded

Event OnActivate(ObjectReference akActionRef)
Game.GetPlayer().AddSpell(YourSpell) ;Adds Spell to the player
Debug.Trace("YourSpell was Learned")
GoToState("SpellAdded")
EndEvent

EndState

State SpellRemoved

Event OnActivate(ObjectReference akActionRef)
Game.GetPlayer().RemoveSpell(YourSpell) ;Removes Spell from the Player
Debug.Trace("YourSpell was Forgotten")
GoToState("SpellRemoved")
EndEvent

EndState
 

Recent chat visitors

Latest posts

Top