Jump to content

Timer Script Help (Change Stage)


Recommended Posts

Posted (edited)
5 hours ago, Jenova23 said:

Does anyone know how to set a timer so that a quest changes stages after a specific amount of time elapses?

 

;; mind this is a low-effort, low-caffeine example ;;

 

Quest property qMyQuest auto ;; example assumes we are looking for stage 30

float property fAdvanceStageTime

 

Event OnUpdate()

   If qMyQuest.GetStage() >= 30 ;; already hit the desired stage, kill the updates

      UnregisterForUpdate()

   ElseIf Utility.GetCurrentGameTime() >= fAdvanceStageTime ;; increment the stage, kill updates

      qMyQuest.SetStage(30)

      UnregisterForUpdate()

   Else ;; stage is less than 30, time has not hit yet, set an update

      RegisterForSingleUpdate(120) ;; really depends on usage, how fast you need that to increment, etc

   EndIf

EndEvent

 

;; would also probably want a way to check the time after wait/sleep, etc.

;; for best performance, this would all be in a state that gets invalidated after the stage is reached, but this might be infeasible if ths is meant to happen multiple times

 

 

EDIT:  wareware's version is probably better and definitely simpler.

Edited by Seijin8

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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