Jump to content

I need someone to write me a simple and short script for my mod.(that gives the player a spell upon activating an activator)


dantw

Recommended Posts

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

 

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


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 by Mattiewagg
Link to comment
Share on other sites

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 by Ghaunadaur
Link to comment
Share on other sites

  • Recently Browsing   0 members

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