dantw Posted July 16, 2015 Share Posted July 16, 2015 I am guessing it will be simple for those with the knowledge anyway. I tried looking for tutorials and on the creation kit wiki but I couldn't find out how to do what I want to do. I just need help writing the script(I know how to copy text to make a script, add the script to an object and make it work with an activator, etc already). I just need the lines of text to paste as a script(I am not wanting an esp or any files unless you want to upload it as a text file) This is my mod that you will be helping if you help me http://www.nexusmods.com/skyrim/mods/67788/?I want a script that gives the player a spell(a spell added by my mod) upon activating an activator that the script is attached to. It may need a check to see if the player already has the spell learned or if possible make the script(I don't know if that is necessary but I don't want it screwing stuff up if the player already has the spell or if they for some reason activate the activator twice)I am planning to add the script to an activator that already has a script(I am assuming that is possible but I don't know if it makes it more complicated to write the script). If there are any more details you need to know in order to help me then please tell me.In case you are curious or need to know for some reason I am planning to add the script to one of the pedestals you activate in Kilkreath temple for Meridia. I want it to add the spell to the player upon activating one of the pedestals. At the moment people using my mod need to acquire the spell through the console or through a spell tome(I know I could just put the spell tome in the temple but I want it to be added through an activator). :) Link to comment Share on other sites More sharing options...
Anikma Posted July 16, 2015 Share Posted July 16, 2015 Actor Property PlayerREF Auto Spell Property MySpell Auto Event OnActivate(Objectreference akActionRef) if akActionRef == PlayerREF PlayerREF.AddSpell(MySpell) Debug.Notification("Dude! You got the spell") endif if PlayerREF.HasSpell(MySpell) Debug.Messagebox("Dude! You already have the spell, technically the script is trying to add it again but seeing as you already have it it doesn't matter. How cool is that?") endif EndEvent Doesn't matter if it already has an attached script, they will both run. By the way I didn't test this script out or even see if it compiles so yell out if you have any problems :) Link to comment Share on other sites More sharing options...
Mattiewagg Posted July 16, 2015 Share Posted July 16, 2015 (edited) Scriptname MyActivatorSpellScript Extends ObjectReference Actor Property PlayerREF Auto; this will autofill Spell Property yourSpell Auto Event OnActivate(ObjectReference akActionRef) If akActionRef == PlayerREF If !PlayerREF.HasSpell(yourSpell); if the PC doesn't have the spell akActionRef.AddSpell(yourSpell) EndIf EndIf EndEvent Edited July 16, 2015 by Mattiewagg Link to comment Share on other sites More sharing options...
Ghaunadaur Posted July 16, 2015 Share Posted July 16, 2015 (edited) Need to cast to an Actor... Scriptname _test2 extends ObjectReference Spell Property SpellToAdd auto Event OnActivate(ObjectReference akActionRef) if akActionRef == Game.GetPlayer() && !(akActionRef as Actor).HasSpell(SpellToAdd) (akActionRef as Actor).AddSpell(SpellToAdd) endif EndEvent Edited July 16, 2015 by Ghaunadaur Link to comment Share on other sites More sharing options...
Mattiewagg Posted July 16, 2015 Share Posted July 16, 2015 meh, or just switch it to PlayerREF. Done. These are things I don't always notice til I compile. Link to comment Share on other sites More sharing options...
dantw Posted July 19, 2015 Author Share Posted July 19, 2015 Thanks everyone. I am going to try these soon(when I am in the mood to work on my mod). Link to comment Share on other sites More sharing options...
Recommended Posts