Jump to content

Papyrus: Basic Script Syntax help


Trapvader

Recommended Posts

I'm trying to attach a script to a book, such that the book will confer an ability (for example, the nord's cold resistance) upon reading it. The script I am using is

 

Scriptname MinArcanaRead extends ObjectReference  
{Adds a perk}
Spell Property ElixirMinArcana auto
Event OnRead(Actor akActor)
   If (akActor == Game.GetPlayer())
       Game.GetPlayer().AddSpell(ElixirMinArcana)
   EndIf
EndEvent

 

However, when I try and compile the script, I get the following error:

 

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\MinArcanaRead.psc(4,0): the parameter types of function onread in the empty state on script minarcanaread do not match the parent script objectreference
No output generated for MinArcanaRead, compilation failed.

 

Any help would be much appreciated, thanks :)

Link to comment
Share on other sites

Alright, I coasted around a few more tutorials and pages on the wiki, and have come up with the following code, which compiles but does not add the effect.

 

Scriptname TomeMinArcanaScript extends ObjectReference  
{Adds a perk}
Spell Property ElixirMinArcana auto
Game Property Player auto
Event OnRead()
  
if (Game.GetPlayer().AddSpell(ElixirMinArcana))
 Debug.Trace("The tome's magic takes effect immediately.")

endIf

EndEvent

 

Any help? It isn't working when it is read from the ground or from the inventory.

Edited by Trapvader
Link to comment
Share on other sites

Add another debug line to the onRead() event, so that you can tell if the event fired at all.

Also, you state you want to add a perk, and instead reference a spell property - which one is it? Have you pointed the ElixirMinArcana to the proper spell in the CK? And if it is a perk you're trying to add, you have to define the property as a perk and use Game.getPlayer().addPerk(myPerk) function.

Link to comment
Share on other sites

Add another debug line to the onRead() event, so that you can tell if the event fired at all.

Also, you state you want to add a perk, and instead reference a spell property - which one is it? Have you pointed the ElixirMinArcana to the proper spell in the CK? And if it is a perk you're trying to add, you have to define the property as a perk and use Game.getPlayer().addPerk(myPerk) function.

My apologies, I was being unclear. I'm adding an ability, such as the racial abilities, that should take permanent effect on reading, not a perk at all.

When I add a debug line to OnRead(), it doesn't fire. Looks like OnRead is having problems triggering.

Link to comment
Share on other sites

Oh boy, I am six different kinds of special.

It wasn't firing because I forgot to assign the spell that would stand in for the Property.

Wow. Thanks for the help everybody, sorry for being a clueless goon :V

 

Don't worry, I just screwed up my multiple follower mod on way more kinds of special because I named various variables, factions and aliases wrongly. *Very frustrated*

Link to comment
Share on other sites

  • Recently Browsing   0 members

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