Hangman4358 Posted May 15, 2012 Share Posted May 15, 2012 Hey, i am trying to get this to work. I want to script to add a spell to the players inventory when they read a book. But i also want to book remain and have writing in it. That is why i do not want to add the spell through the normal way of just telling the book to teach the spell. So i came up with this script Scriptname OAQ01RewardBookScript extends ObjectReference SPELL Property OAQ01RewardSpell Auto if !(Game.GetPlayer.HasSpell(OAQ01RewardSpell)) Event OnRead() Game.GetPlayer().AddSpell(OAQ01RewardSpell, False) Debug.Trace("Dunmer Lore learned!") EndEvent endIf The CK is telling me the problem is with "if !(Game.GetPlayer.HasSpell(OAQ01RewardSpell))". How exactly do I make the script only when the player does NOT have the spell? Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted May 15, 2012 Share Posted May 15, 2012 (edited) I don't know any Papyrus, but have you tried putting the if clause "inside" the Event block? If it's any close to Oblivion scripting, there can't be anything like that "outside" of the Event blocks. It's just wild guessing though. Oh, and it seems you're missing the function brackets at the end of the GetPlayer inside the if clause. Edited May 15, 2012 by DrakeTheDragon Link to comment Share on other sites More sharing options...
LittleBaron Posted May 15, 2012 Share Posted May 15, 2012 As a papyrus user, I can say that both of Drake's observations are correct. :thumbsup: Link to comment Share on other sites More sharing options...
Hangman4358 Posted May 15, 2012 Author Share Posted May 15, 2012 ok, thanks guys. I am new to scripting in general so my eyes go a bit wonky. Link to comment Share on other sites More sharing options...
steve40 Posted May 16, 2012 Share Posted May 16, 2012 (edited) Hey, i am trying to get this to work. I want to script to add a spell to the players inventory when they read a book. But i also want to book remain and have writing in it. That is why i do not want to add the spell through the normal way of just telling the book to teach the spell. So i came up with this script Scriptname OAQ01RewardBookScript extends ObjectReference SPELL Property OAQ01RewardSpell Auto if !(Game.GetPlayer.HasSpell(OAQ01RewardSpell)) Event OnRead() Game.GetPlayer().AddSpell(OAQ01RewardSpell, False) Debug.Trace("Dunmer Lore learned!") EndEvent endIf The CK is telling me the problem is with "if !(Game.GetPlayer.HasSpell(OAQ01RewardSpell))". How exactly do I make the script only when the player does NOT have the spell? As commented above, plus you missed the () at the end of GetPlayer in your IF statement. Scriptname OAQ01RewardBookScript extends ObjectReference SPELL Property OAQ01RewardSpell Auto Event OnRead() If !Game.GetPlayer().HasSpell(OAQ01RewardSpell) Game.GetPlayer().AddSpell(OAQ01RewardSpell, False) Debug.Trace("Dunmer Lore learned!") Else Debug.Trace("Dunmer Lore not learned") EndIf EndEvent PS. if you use "debug.notification" instead of "debug.trace" it will print the message at the top left you your screen while you are in-game :) Edited May 16, 2012 by steve40 Link to comment Share on other sites More sharing options...
Recommended Posts