Jump to content

Adding money to a chest every 24 hours


littleork

Recommended Posts

Hello everyone

 

I am doing a quest that makes you buy a forge from a npc, once you buy it, I want 300 gold to spawn in a chest every 24 hours. I was helping myself from the spouse quest to try to understand the coding but looks like I hit a wall.

 

What I pretty much did is that on the last stage of my quest, I added alias_mordrin.RegisterForUpdateGameTime(24) mordrin being my chest alias, on the alias I made a forced reference to that chest.

 

On the alias, I have this script

Event OnUpdateGameTime()

If rpgbsProfit.getstage()==20

mordrin.getreference().additem(gold001,300)
	
	
EndIf

EndEvent

 

 

 

 

But it seems like its not the way the code is suppose to work and I dont really know where to start to search for errors, any help?

 

 

Thanks in advance

Link to comment
Share on other sites

Try this

 

ScriptName ChestQuestAliasScript extends ReferenceAlias

ObjectReference Property gold001 auto

Event OnUpdateGameTime()

       If GetOwningQuest().GetStage() == 20
	self.GetRef().AddItem(gold001, 300)
EndIf

EndEvent

 

After adding this script to the chest alias, you'll need to click the properties button, then auto-fill.

Edited by steve40
Link to comment
Share on other sites

Try this

 

ScriptName ChestQuestAliasScript extends ReferenceAlias

ObjectReference Property gold001 auto

Event OnUpdateGameTime()

       If GetOwningQuest().GetStage() == 20
	self.GetRef().AddItem(gold001, 300)
EndIf

EndEvent

 

After adding this script to the chest alias, you'll need to click the properties button, then auto-fill.

 

 

It worked! Thank you so much for your help! I was about to give up on this.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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