AngelDeath82 Posted February 26, 2017 Share Posted February 26, 2017 Hello, I'm looking for some further assistance with my mod which is designed to add skills and perks to the player upon reading a book. I've gotten past a few issues, including a CTD from cloning the wrong book, working out how to properly get the player character's name, and getting If statements functioning properly. What remains is why Perks are failing to add to the character.Here's the relevant portions of my code: ScriptName _LearnStuff extends ObjectReference Actor Property pPlayerRef Auto Perk Property RestorationNovice00 Auto Perk Property Regeneration Auto ... Event OnRead() pPlayerRef = Game.GetPlayer() pPlayerRef.AddPerk(RestorationNovice00) pPlayerRef.AddPerk(Regeneration) And here's the output I get from Papyrus.log [02/25/2017 - 05:12:46PM] Error: Attempted to add invalid perk to the actor stack: [ (00000014)].Actor.AddPerk() - "<native>" Line ? [Item 2 in container (00000014)]._LearnStuff.OnRead() - "_LearnStuff.psc" Line 53 [02/25/2017 - 05:12:47PM] Error: Attempted to add invalid perk to the actor stack: [ (00000014)].Actor.AddPerk() - "<native>" Line ? [Item 2 in container (00000014)]._LearnStuff.OnRead() - "_LearnStuff.psc" Line 54 Thanks in advance. :smile: Link to comment Share on other sites More sharing options...
cdcooley Posted February 26, 2017 Share Posted February 26, 2017 That's looks like you haven't filled your script's properties in the CK. And related to that you should either use a PlayerRef property or use Game.GetPlayer() but not both! So choose one of these two: ScriptName _LearnStuff extends ObjectReference Actor Property PlayerRef Auto Perk Property RestorationNovice00 Auto Perk Property Regeneration Auto ... Event OnRead() PlayerRef.AddPerk(RestorationNovice00) PlayerRef.AddPerk(Regeneration) ScriptName _LearnStuff extends ObjectReference Perk Property RestorationNovice00 Auto Perk Property Regeneration Auto ... Event OnRead() Actor PlayerRef = Game.GetPlayer() PlayerRef.AddPerk(RestorationNovice00) PlayerRef.AddPerk(Regeneration) The first will run faster but uses a little more memory. Since the event only runs when the player reads a book I would use the second one. Link to comment Share on other sites More sharing options...
AngelDeath82 Posted February 28, 2017 Author Share Posted February 28, 2017 Thank you very much, cdcooley. Your assistance was greatly appreciated. With regards to the PlayerRef declaration, I went with your recommended option #2. I finally had a chance to test this (once I determined what you meant by 'filled your script's properties in the CK'), and it is functioning properly. I do find it interesting that you need to manually declare the Perk Property lines in the script, cite the specific perks in the AddPerk lines in the script, and yet you also have to set the individual properties within your mod in CK on the script attached to the book... very curious indeed. The next step I think for this will be instead of having it be a book you must read, to have it be something which will occur automatically after the character creation step of the game. But, that's a task for another day. :) Link to comment Share on other sites More sharing options...
Recommended Posts