Jump to content

Adding Perks to both Player and NPC via weapons with script?


Recommended Posts

So, I know that you can't dynamically add Perks to NPC's like adding it to racial powers and whatnot or magiceffects.

So, I thought about the SilverPerk for Silver weapons which is a perk that is added and removed by script when the weapon is equiped or unequipped. Does this script affect the NPC's as well?

I have a custom weapon with the exact same script as the silversword one, except I changed it to add my own custom perk to my weapon. And while it seems to work for me, I don't think followers or any other NPC are actually getting the perk.

So, I wanted to know if NPC's like Silver Hand can actually get the Perks or do they get nothing?

 

Link to comment
Share on other sites

The "SilverSwordScript" will add the perk to any NPC that will equip the object that the script is living in.

Vanilla script:

Scriptname SilverSwordScript extends ObjectReference


Perk Property SilverPerk auto


Event OnEquipped(Actor akActor)

akActor.AddPerk(SilverPerk)

EndEvent


Event OnUnEquipped(Actor akActor)

akActor.RemovePerk(SilverPerk)

EndEvent

Link to comment
Share on other sites

 

The "SilverSwordScript" will add the perk to any NPC that will equip the object that the script is living in.
Vanilla script:
Scriptname SilverSwordScript extends ObjectReference
Perk Property SilverPerk auto
Event OnEquipped(Actor akActor)
akActor.AddPerk(SilverPerk)
EndEvent
Event OnUnEquipped(Actor akActor)
akActor.RemovePerk(SilverPerk)
EndEvent

 

Ah. So anyone can get it then? Is there a way for me to confirm that an NPC has the perk given by the srcipt in game?

Link to comment
Share on other sites

Okay, things are super wrong here and I don't know why.

 

First, I can't find the SilverPerk or my Perk at all in game. I type help SilverPerk and nothing shows up, neither does mine.

 

Silver Swords adds the perk to NPC's and myself, although my weapon won't add anything for some reason even though it's using the same script, just changed to include my perk and it gave zero errors when compilling.

 

So, what's going on?

Link to comment
Share on other sites

A) The 'Silver Perk' works only with weapons that have the keyword "WeaponMaterialSilver".

B) The 'SilverPerk' is Hidden.

C) "just changed to include my perk and it gave zero errors when compilling"

For what i can understand, you have 'Edited' the vanilla script !, this is a big NO NO.

Either you add your perk through the properties on the vanilla script, or you create a 'New Custom' script to do what you want.

Link to comment
Share on other sites

  • 2 months later...

 

A) The 'Silver Perk' works only with weapons that have the keyword "WeaponMaterialSilver".
B) The 'SilverPerk' is Hidden.
C) "just changed to include my perk and it gave zero errors when compilling"
For what i can understand, you have 'Edited' the vanilla script !, this is a big NO NO.
Either you add your perk through the properties on the vanilla script, or you create a 'New Custom' script to do what you want.

 

Sorry for the super late reply, but could you explain this better?

 

What are the actual steps that I need to take to make this script work?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...