How to properly use the HasPerk function in Skyrim?

Post » Sat Dec 21, 2013 3:33 pm

In Oblivion, I was able to use Object names (not their hexadecimal 4-byte FormIDs) as arguments to functions, for example:

SomeFunction aaaSomeObject
In Skyrim, that doesn't appear to work. I'm currently looking into writing a script that needs to test if the player character has a specific perk. For example, in Skyrim:

if player.HasPerk(AugmentedFlames)   x = 10endif
throws a compile error because HasPerk can't connect the object name ID AugmentedFlames with the actual object. I do not want to use GetForm with the hexadecimal FormID because that would be lousy programming practice (the Creation Kit wiki even says so).
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Sat Dec 21, 2013 10:16 pm

Properties. They're variables which point to your perk.

Ex:

Scriptname _test_testscript extends Quest   Perk Property SuperCoolPerk AutoFunction SomeFunction()    if Game.GetPlayer().HasPerk(SuperCoolPerk)        Debug.Notification("The player has the super cool perk")    endIfendFunction

Then the CK, you hit the edit properties button next to where you attached your script, and choose what you want "SuperCoolPerk" to point to. If the name exactly matches an existing perk, you can hit the auto-fill button and it will select it for you.

You might want to check out some basic papyrus tutorials too. I'm sure someone else here can link you to a good one :smile:

User avatar
Claire Vaux
 
Posts: 3485
Joined: Sun Aug 06, 2006 6:56 am


Return to V - Skyrim