MadTod Posted February 22, 2013 Posted February 22, 2013 I'm trying to make an item that when in my inventory will a several spells and then when droped will remove said spells.Basicly I need a script that adds and removes spells. Any help would be very much appreciated, thanks.
VectorPlexus Posted February 22, 2013 Posted February 22, 2013 (edited) I would try something like this (didnt tested it, but should work). Attach it to your Object Form: Scriptname YourScriptName extends ObjectReference ObjectReference Property PlayerREF Auto MiscObject Property YourObject Auto Spell Property YourSpell Auto Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if akNewContainer == PlayerREF && PlayerREF.GetItemCount(YourObject) == 1 Game.GetPlayer().AddSpell(YourSpell, false) elseif akOldContainer == PlayerREF && PlayerREF.GetItemCount(YourObject) == 0 Game.GetPlayer().RemoveSpell(YourSpell) endIf endEvent Dont forget to define the properties xP Edited February 22, 2013 by VectorPlexus
MadTod Posted February 23, 2013 Author Posted February 23, 2013 (edited) Thanks, will try it.When I save the script it fails. Edited February 23, 2013 by TanisDuncan
MadTod Posted February 24, 2013 Author Posted February 24, 2013 (edited) The reason it failed was because I hadn't set the properties but now that I have it worked, so thanks for the help. Edited February 24, 2013 by TanisDuncan
Recommended Posts