Jump to content

[Help] Adding a perk by equipping an item


TheGreatVax

Recommended Posts

I'm fairly new to Skyrim modding, and while I know the basics of scripting, I'm still having trouble applying a lot of things, and a seemingly unfinished Wiki isn't of much help for me right now.

As I've finally settled on a somewhat serious little project, I've already more or less hit a brick wall.

 

Here's basically what I want to do:

I want to use a perk to apply a set bonus for a specific armor set (think: Dark Brotherhood set), but I must not edit the actor file "Player", as this might create conflicts with other mods who had the similar idea behind them.

When an actor equips any of these specific items, it should execute a script which checks whether said actor has the perk, then adds it, if not.

I do not want to use any external means of acquiring the perk (only through equipping the item/s), and if at all possible, apply it to NPCs (in this case followers) aswell, using the same method.

 

- How do I execute a script on an actor, when they equip that specific item? (These are unique items, modifying them is not a problem)

- How do I properly check, then add a perk to that actor?

- Is there a way to add a perk to a non-player actor? I've tried AddPerk, but not only did that not work, because I seemingly couldn't get my script to fire, but it would also fail to compile when I didn't specifically do that on Game.GetPlayer()

 

 

I can hardly post any progress, as I haven't made much yet, considering I barely know what I'm doing.

I hate to straight up ask for examples, but I'd greatly appreciate if someone made a little step-by-step walkthrough on how to achieve this.

 

 

Thanks in advance :)

Link to comment
Share on other sites

I'm just about to release a mod that uses Perks to modify some things, so I can share with you what I've learned. (I've been a programmer for a lot of years, but I've only been working with Papyrus for about a month, so I'm no expert with it.)

 

The Standing Stones each add a Perk to the player. That can be a good place to start reverse engineering how Perks work.

 

Basically, a Perk is applied to the player by a Magic Effect, which is invoked by a Spell. In the script you will need to add the spell to the player when the appropriate conditions are met. Player.AddSpell(spellname)

 

Utility.Debug.MessageBox("your text here") will become your new best (scripting) buddy.

 

One method of attaching a script to a player is by creating a Quest object. Check the box, "Start game enabled", and then attach your script to the Quest. Put a message box in the OnInit() function and it will show up when you load a game to test it. (Which also makes a nice reminder that you're modding and not playing.) In a script attached like this, you're working with a player reference, and not directly on the player object, so you're safe in terms of conflicting with other mods. (Depending on what you do in your script, of course.) (And, in case you're wondering... no, a Quest does not show up in the player's Quest Journal, unless you set it to do so.)

 

Since a script attached to a Quest like this will be running all the time, one needs to keep it small and quick running.

 

You're right, the Creation Kit wiki is woefully inadequate. But, this "language" has only been released to the public for a few months. (Also, it's a wiki, which means once we know enough, we write it.)

 

That should get you started down a good path.

 

Regards, Calen

 

(If any Papyrus experts, or just adequately knowledgeable people even, wish to add or correct anything to the above, please do so, and I will be an avid student.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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