Jump to content

Adding a perk as soon as game starts


Recommended Posts

Hi guys,

 

So I am trying to figure out how to make the game add a hidden perk to the player right when you enter the game. I figure this would be done via quest script, but so far what I have is not working.

 

So if I do it with a quest, how do I tell the game to start that quest immediately when the game starts? If I check "Start Game Enabled", should that be it?

 

Also, as far as scripting goes, I think what I have is right, but maybe not:

Scriptname mkAddperkQuestScript extends Quest  

Perk Property mkPerk  Auto  

Event OnUpdate()
Game.GetPlayer().AddPerk(mkPerk)
Debug.MessageBox("Update ran")
endEvent

 

Perhaps I shouldn't use the onUpdate Event?

 

So what I am trying to figure out, is if the actual script is not working, or if the quest itself isn't working.

 

Thanks!

Link to comment
Share on other sites

Currently there is no call to update that is why things are not working. Here is a better way of handling it.

 

Scriptname mkAddperkQuestScript extends Quest  

Perk Property mkPerk  Auto  

Event OnInit() ;This event is called when the game initiates
       Game.GetPlayer().AddPerk(mkPerk)
       Debug.MessageBox("Update ran")
endEvent

 

Alternatively if you did wish to use an update for another reason you would do this

 

Scriptname mkAddperkQuestScript extends Quest  

Perk Property mkPerk  Auto  

Event OnInit() ;This event is called when the game initiates
       RegisterForUpdate(1) ;This sets up the script to update every second
endEvent

Event OnUpdate() ;This event is now called every second
       Game.GetPlayer().AddPerk(mkPerk)
       Debug.MessageBox("Update ran")
       unregisterForUpdate() ;This will end the update every second when your have done your job. This can be put anywhere but is here as an example
endEvent

 

Hope this helps :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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