Trapvader Posted February 25, 2012 Share Posted February 25, 2012 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 More sharing options...
tunaisafish Posted February 25, 2012 Share Posted February 25, 2012 OnRead takes no arguments. so it's just 'Event OnRead()'. I don't think it passes the reader Actor, as NPC's don't trigger that event. Link to comment Share on other sites More sharing options...
Trapvader Posted February 26, 2012 Author Share Posted February 26, 2012 (edited) 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 February 26, 2012 by Trapvader Link to comment Share on other sites More sharing options...
GomuGomu64 Posted February 26, 2012 Share Posted February 26, 2012 Try Player.addspell FormIDofSpellHere Link to comment Share on other sites More sharing options...
Trapvader Posted February 26, 2012 Author Share Posted February 26, 2012 Try Player.addspell FormIDofSpellHereTried that, no dice.The script compiles with the amended script above, but nothing happens when the book is read - no message is displayed. Link to comment Share on other sites More sharing options...
Mansh00ter Posted February 26, 2012 Share Posted February 26, 2012 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 More sharing options...
Trapvader Posted February 26, 2012 Author Share Posted February 26, 2012 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 More sharing options...
Trapvader Posted February 26, 2012 Author Share Posted February 26, 2012 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 Link to comment Share on other sites More sharing options...
GomuGomu64 Posted February 26, 2012 Share Posted February 26, 2012 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 More sharing options...
11BlueBlood Posted March 4, 2012 Share Posted March 4, 2012 Would you mind posting what the final copy looks like =DThanks in advance...Right now I'm trying to make an object an activator to add a spell to the charecter, Link to comment Share on other sites More sharing options...
Recommended Posts