ConcreteTraveler Posted November 25, 2012 Share Posted November 25, 2012 (edited) For a new mod project, I need to add some perks to NPCs.I tried in various ways but none works. I have created a Quest Quest Aliases : points to a unic actor. 1st Method_________________________________________________________________________Scripts : Actor Property myActor AutoPerk Property myPerk Auto Event OnInit() ; This event will run once, when the script is initialized RegisterForSingleUpdate(2) GotoState ("polling")EndEvent State polling Event OnUpdate() myActor.AddPerk(myPerk) If myActor.HasPerk(myPerk) Debug.TraceAndBox("Perk added") Else Debug.TraceAndBox("Error Perk not added") EndIf UnregisterForUpdate() GotoState ("active") ; Switch to a state that doesn't use OnUpdate() EndEventEndState State active ; Do nothing in hereEndState 2nd Method____________________________________________________________________________Scripts : Propertys : the ReferenceAlias of my actor. the Perk I want to add to my actor.________________________________________________________________________ Script code : Scriptname FPstart extends Quest ReferenceAlias Property myRefActor Auto Perk Property myPerk Auto Event OnInit() ; This event will run once, when the script is initialized RegisterForSingleUpdate(2) GotoState ("polling")EndEvent State polling Event OnUpdate() myRefActor.GetActorReference().AddPerk(myPerk) If myRefActor.GetActorReference().HasPerk(myPerk) Debug.TraceAndBox("Perk added") Else Debug.TraceAndBox("Error perk not added") EndIf UnregisterForUpdate() GotoState ("active") ; Switch to a state that doesn't use OnUpdate() EndEventEndState State active ; Do nothing in hereEndState__________________________________________________________________________________ It everytime goes to the Error debug, as well as if I am in the same cell thant the actor, as if I am not. Edited November 25, 2012 by ConcreteTraveler Link to comment Share on other sites More sharing options...
Shaydow Posted November 25, 2012 Share Posted November 25, 2012 I am really not the best at papyrus, but I think you can replace GetActorReference with GetReference, though I may be wrong. I was interested in this, this was the best I could find, since .addperk only seems to apply to the player, and not an objectreference. http://www.gameskyrim.com/addperk-npc-t259951.html Good luck Link to comment Share on other sites More sharing options...
ConcreteTraveler Posted November 25, 2012 Author Share Posted November 25, 2012 (edited) Ah yes, I have not see it was noticed at the Actor::AddPerk() CreationKit wiki in the Notes section.I've take a look at your link, is talking about ActorBase objects with Spell::RemoteCast() function, its author saids "It's not very efficient or pretty :-) but it's the best I could do".Unfortunately what he does is not compatible with the project I'm making. Hoping together for a soon SKSE or creation kit update which allow the Actor::AddPerk() function to NPSs. Edited November 25, 2012 by ConcreteTraveler Link to comment Share on other sites More sharing options...
SkyrimModHunter Posted June 4, 2014 Share Posted June 4, 2014 Does anyone know if an SKSE function was ever developed or did anyone figure out a good method to add a perk via a script? Link to comment Share on other sites More sharing options...
Shaydow Posted June 5, 2014 Share Posted June 5, 2014 I am really not the best at papyrus, but I think you can replace GetActorReference with GetReference, though I may be wrong. I was interested in this, this was the best I could find, since .addperk only seems to apply to the player, and not an objectreference. http://www.gameskyrim.com/addperk-npc-t259951.html Good luck Does anyone know if an SKSE function was ever developed or did anyone figure out a good method to add a perk via a script? As far as I STILL know, as far as scripting, you can still only call on a perk to the player and not on any outside asset. There is still a way to do it, but then the perk for the NPC becomes constant, and not a toggle. This allows you to apply the perk to the NPC, but it is ALWAYS on, you can never turn it off. You need to make your perk an ability, and then apply that ability through the MagicEffect in the creation kit. Any perk can be applied this way, though with NPC's the ME ( MagicEffect) must be a constant and can never be a function call. As far as I know. If I am wrong maybe someone can point you in the right direction. I hope this helps. Link to comment Share on other sites More sharing options...
Recommended Posts