Jump to content

Adding Perk to Player via Script?


MarchUntoTorment

Recommended Posts

Hey, everyone! Long-time reader, first-time poster.

 

I'm trying to make a script that gives the player a perk when the game loads. The script runs fine, but the perk never appears. Adding the perk via console makes it work perfectly.

 

Script (sorry for lack of syntax, on phone, PC is having internet troubles):

 

--------

 

Scriptname: ThiefMod:ThiefScript4 extends Quest

 

Actor Property PlayerRef Auto

 

Perk Property ThiefPerk Auto

 

Event OnInit()

 

PlayerRef.AddPerk(ThiefPerk)

 

Debug.Notification("Welcome, Thief.")

 

EndEvent

 

--------

 

This is all attached to a dummy quest that's set to RunOnce. Ignore the bad syntax; the Property block and the Event blocks all have single-line breaks between them.

 

Anyway, when I load the game, the message ("Welcome, Thief.") shows, which means the script is firing, but the perk isn't being added. I tried to use Game.GetPlayer() instead of PlayerRef, but had no success there, either.

 

Where am I going wrong? Help would be greatly appreciated!

Link to comment
Share on other sites


Scriptname ThiefMod:ThiefScript4 extends Quest

Actor Property PlayerRef Auto mandatory const
Perk Property ThiefPerk Auto mandatory const

Event OnQuestInit()
If !PlayerREF.HasPerk(ThiefPerk)
PlayerRef.AddPerk(ThiefPerk, True)
Debug.Notification("Welcome, Thief.")
EndIf
EndEvent
Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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