Jump to content

Please help me fix this Script I dont know what I did wrong


artemissrose

Recommended Posts

Hello
I really need some help with this script ive been trying to write for the past week. Im new to scripting and I cant find any solution to what im doing wrong. If someone could please help I would really appreciate it. Im just using this for personal use nothing more.
Im trying to create a script that will allow me to add and remove a spell from the player by clicking on a static spelltome.
This is what I have so far and it might just be completely wrong I dont know
Scriptname SpellTome_Script extends activemagiceffect
Spell Property YourSpell auto
Event OnActivate(Actor akTarget, Actor akCaster)
If akTarget.HasSpell(YourSpell) == false
Debug.Notification("You have learned YourSpell!")
Game.GetPlayer().AddSpell (YourSpell)
Else
akTarget.RemoveSpell(YourSpell)
Debug.Notification("YourSpell Removed.")
Game.GetPlayer().RemoveSpell(YourSpell)
EndIf
EndEvent
Link to comment
Share on other sites

Ok Update 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... any suggestions? could really use the help
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
Link to comment
Share on other sites

  • Recently Browsing   0 members

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