Papyrus adding spells to the player?

Post » Sun Jun 17, 2012 6:53 pm

I wanted to make an activator that when you activate it the player receives some spells

what I have so far.


Scriptname AddSpellTest extends ObjectReference
{My first script with papyrus}

int count

Event OnActivate(ObjectReference akActionRef)
count = count + 1
if count == 1
Debug.MessageBox("The Altar fills you with strength!")
Game.GetPlayer().AddSpell(What Do I put here?)
endif
if count > 1
Debug.MessageBox("The Altar has gone quiet.")
endif
endEvent

I want to know how I can make the script work if this doesn't and also what to put in for the spell id
User avatar
Bitter End
 
Posts: 3418
Joined: Fri Sep 08, 2006 11:40 am

Post » Mon Jun 18, 2012 4:06 am

Add a 'Spell' property to your script
then on whatever object/actor you are working with, you can then utilize that Spell Property, as a dropdown box, to select the spell you want.

Its important to know, that this system is setup to be highly re-usable.
Eg- The script you are working on now, wont just allow you to add a single spell, you could potentially re-use it to add any other spell also -
eg - on one actor, you select Heal in the dropdown list, but in another you select Fireball etc

Thats what the 'Properties' system seems to be there for.
Arguments that you feed into the papyrus functions, I think need to be defined as properties for the script first.
User avatar
MARLON JOHNSON
 
Posts: 3377
Joined: Sun May 20, 2007 7:12 pm

Post » Sun Jun 17, 2012 4:33 pm

so does the syntax

game.getplayer().addspell( spell )

what does the script use to determine the id of the spell does it use creation kit form id? spell name? or....?

thanks for the reply but what If I am working inside of notepad++ how would I know what to put there?
User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm

Post » Mon Jun 18, 2012 12:11 am

http://www.creationkit.com/Bethesda_Tutorial_Papyrus_Events_and_Properties

Look in this tutorial how the spell is added to the Draugr. That may help.
User avatar
Jason Rice
 
Posts: 3445
Joined: Thu Aug 16, 2007 3:42 pm

Post » Mon Jun 18, 2012 5:16 am

Thanks for the link I never saw that page of the wiki when I was looking through the tutorials.
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Mon Jun 18, 2012 6:40 am

Specifically, you need to have a line in your script like this

Spell property reanimateSpell auto

Then you can say
game.getplayer().addspell( reanimateSpell )


Its important to know, that reanimateSpell is just the name of the variable, not its value.
You set the value, outside of the papyrus script, via the property manager. (At least... so far thats how im doing it)

You would then see a property called 'reanimateSpell'
and you will have a dropdown beside it, listing all the spells in the game.
Select the one you want for this instance, and then click ok

Clicking ok will attempt a compile with the value you selected.
Make sure you check for errors etc.
User avatar
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm


Return to V - Skyrim