Jump to content

Need script help for a timer.


dontpanic

Recommended Posts

Did you mean adding auto at the end of the script like I did below?

GotoState ("auto")

 

I tried placing it in the first script and it didn't seem to have an effect.

 

Scriptname aaIncomeScript extends Quest 


MiscObject Property Gold  Auto  ;I set the gold from the game for this
Quest Property  InnQuest  Auto

Event OnInit() ; This event will run once, when the script is initialized
RegisterForUpdateGameTime(24)
EndEvent

State Running
 Event OnBeginState()
   Debug.Trace("Entered the running state!")
 EndEvent
EndState

State polling	

Event OnUpdateGameTime()			
	if (InnQuest.GetStage() == 20)
                       Game.GetPlayer().AddItem(Gold, 300, true) ; gives player 300 gold
		Debug.Trace("Got what we needed, so stop polling!")
		GotoState ("auto")
		
	endif
EndEvent
EndState

 

I have the script above tied to a Quest. The quest is activated via initialization from a menu script, that seems to be working for it's other functions. This is the only thing stopping my progression in finishing... Thank you for coming this far with me. Hopefully I can find a solution soon.

Edited by dontpanic
Link to comment
Share on other sites

No, I mean like this:

auto State polling

 

You need to include something like this in your OnInit event:

GoToState(Polling)

You also need to use that function whenever your script should change states. It won't do what you want unless you tell it to, after all.

 

Cipscis

Link to comment
Share on other sites

I was able to get the script to give me the item after 1 day (I set one day for testing), but it won't give me anything after that. I want it to continuously provide 300 gold every one week.

 

Scriptname aaIncomeScript extends Quest 


MiscObject Property Gold  Auto  ;I set the gold from the game for this
Quest Property  InnQuest  Auto
ObjectReference Property PlayerSafe  Auto  



Event OnInit() ; This event will run once, when the script is initialized
RegisterForUpdateGameTime(24)
      GoToState ("polling")
EndEvent

State Running
 Event OnBeginState()
   Debug.Trace("Entered the running state!")
 EndEvent
EndState

auto State polling

Event OnUpdateGameTime()			
	if (InnQuest.GetStage() == 20)
                   PlayerSafe.AddItem(Gold, 300, true) ; gives Safe 300 gold
		Debug.Trace("Got what we needed, so stop polling!")
		GotoState ("active")
		
	endif
EndEvent
EndState

Edited by dontpanic
Link to comment
Share on other sites

You've told your script to go to a state called "active" (which you haven't defined in your script), and it's never told to return to your "polling" state. I don't see any advantage to using states in this script in the first place, to be honest. They're adding complexity without solving any problems.

 

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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