dbbolton Posted October 19, 2014 Share Posted October 19, 2014 (edited) I am working on a personal mod that includes a book to give the player a perk. I have found several forum posts of the same question, and cross-referenced the CK wiki. However, my script isn't working. Here is the source: Scriptname _dbbAlcBookScript extends ObjectReference Perk property Alchemist00 auto Perk property Physician auto Event OnRead() Game.AdvanceSkill("Alchemy",10000000) Game.GetPlayer().AddPerk(Alchemist00) Game.GetPlayer().AddPerk(Physician) debug.messagebox("TEXTTEXT") EndEventand here is a view of the properties window: http://i.imgur.com/mDUnhrh.png When the player reads the book, the Alchemy skill is fully leveled, and the debug message appears, but the perks are not added. My test character is a brand new character that doesn't have any perks. I tried out the same script format on Enchanting and it worked exactly as expected. Then I tried tweaking the Alc script. I added all five ranks of Alchemst, Physician, and Benefactor. When I read the book in-game, only Benefactor was added to the character. It seems like something is fishy with the Alchemist and Physician perks. Another weird thing I noticed: after reading the book, if I try to choose the first Alchemist perk by hand, it instantly gives me all five ranks. It's almost as if the perks are being added but not showing up for some reason. They also don't show up when I check with HasPerk. Side note: I wanted to mention that I know how to do this with a batch script but I would much rather do it through an in-game item. Edited October 19, 2014 by dbbolton Link to comment Share on other sites More sharing options...
Plastrader Posted October 19, 2014 Share Posted October 19, 2014 (edited) Unfortunately I can't reproduce the problem you're having. Scriptname _LearnStuff extends ObjectReference Actor Property pPlayerRef Auto ;Should use this instead of Game.getPlayer() (IMHO) Perk Property Alchemist00 Auto Perk Property Alchemist20 Auto Perk Property Alchemist40 Auto Perk Property Alchemist60 Auto Perk Property Alchemist80 Auto Perk Property Physician Auto Event onRead() Debug.Notification("TROLLOL " + Alchemist00 ) Game.AdvanceSkill("Alchemy",2425448) Game.GetPlayer().AddPerk(Alchemist00) Game.GetPlayer().AddPerk(Alchemist20) Game.GetPlayer().AddPerk(Alchemist40) Game.GetPlayer().AddPerk(Alchemist60) Game.GetPlayer().AddPerk(Alchemist80) Game.GetPlayer().AddPerk(Physician) EndEvent Results in:Alchemy 100Alchemist 5/5Physician Do you have some mods which interfere perhaps? Edited October 19, 2014 by Plastrader Link to comment Share on other sites More sharing options...
dbbolton Posted October 20, 2014 Author Share Posted October 20, 2014 Thanks for the response. I actually tried disabling all mods, loading only Skyrim, Update, and my mod but I had the same problem. I'm starting to think that my hunch about the perks not showing up could be the case. Here are some levels of a Fortify Enchanting potion that I've experimented with: just 100 alchemy -> 8%100 alchemy + relevant perks added with batch script -> 15%after only reading the book -> 15% However, if I run the batch script after reading the book, the potion will drop back down to 8%! Even reading the book and/or running the script won't bring it back up to 15%. Seems really odd to me. Also, could you explain a bit more about pPlayerRef? What is the point of declaring it up front if you still use Game.GetPlayer() in the Event block? Link to comment Share on other sites More sharing options...
Plastrader Posted October 20, 2014 Share Posted October 20, 2014 (edited) You are welcome!This seems strange indeed. :/ Try this and see if it works. main menu, drop console:coc whiterunbanneredmare turn to your right, just below the drawer you see a book on the floor. About pPlayerReference I've read on several places that using references instead of Game.getPlayer() is better for performance.(i.e. not as demanding on the script engine)To test your way of doing things I used Game.getPlayer() the p is just my namingstandard for "properties"(I ignored that in the script above to use exactly what you used) You can also add in your script Event onRead() Debug.trace("P1=" + Alchemist00) Debug.trace("P2=" + Alchemist20) Debug.trace("P3=" + Alchemist40) (etc) ... EndEventAnd look in your papyruslogs if there are anything in those properties. Edited October 20, 2014 by Plastrader Link to comment Share on other sites More sharing options...
dbbolton Posted October 26, 2014 Author Share Posted October 26, 2014 I tried out your version and it worked, so I copied the script source and tried it in the original mod file, and it worked. Since the only differences are the "Actor Property pPlayerRef Auto" line and the skill increase amount, I'm guessing one of those things did the trick. Link to comment Share on other sites More sharing options...
Recommended Posts