Dynamic Timer Update Problem

specialist_3specialist_3 Member Posts: 121
edited November -1 in Working with GS (Mac)
I have a game where initially, a creep.change.interval is set to 10 seconds. After that 10 seconds, the creep.change.interval is changed to 3 seconds for the rest of the game.

What I am facing is, after the 10 seconds is up, the new interval is set 3 but continues to countdown to -6 and then back to 3 seconds. It seems that timer does not accept dynamic values which have changed.

Suppose, I have 3 variables.
Level.Timer - Overall timer
Creep.Change.Interval (constant value)
Interval (countdown variable)

Change Attribute Method,
Initially Creep.Change.Interval = 10
Interval = Creep.Change.Interval

Every 1 second,
Level.Timer = Level.Timer -1
Interval = Interval -1

Every Creep.Change.Interval seconds (To reset the Interval to countdown again)
Change Attribute Interval to Creep.Change.Interval

After sometime, if I change Creep.Change.Interval to 3,

Interval seems to be set to 3 but the Timer still continues to run for 10 seconds till -6.

So first time 10 9 8 7 6 5 4 3 2 1..and then 3 2 1 0 -1 -2 -3 -4 -5 -6 ...3 2 1.....

Does the timer function in GS accept dynamic changes to its value?

Comments

  • StusAppsStusApps Member, PRO Posts: 1,352
    No it is not dynamically changeable.

    you could run one timer that starts when an attribute is true and not tick 'run to completion' then put another when that attribute is false. As they are not running to completion if the starting factor changes they will stop running and the other will start.

    eg:

    set integer attribute 'whichtimer' to 1

    rule: if game.whichtimer=1 then:

    timer runs, after 20 secs change attribute to game.whichtimer=2

    rule: if game.whichtimer=2 then:

    timer runs, after 10 secs then do something......

    you could use this dynamic timer idea to have something else keep altering which timer is running.

    Not sure that answers your problem but it might help.
  • specialist_3specialist_3 Member Posts: 121
    Thanx mate...lemme try your solution
Sign In or Register to comment.