Frozenhelfir
set Gwypaas = Guhveepaws
- Reaction score
- 56
I have a few things that need to run every 5, 15, and 60 seconds. However I want to put them all in the same trigger and action so it prevents as much lag as possible because there are a lot of things that could be added. My main problem is not knowing a method for obtaining the game time. I've done some searching of the constants to no avail. Here's the code:
JASS:
scope PeriodicThings initializer InitTrig
private function PERIODIC takes nothing returns nothing
local integer time = GetIntegerGameState(???????)
if ModuloInteger(time,60) == 0 then
//do the actions that happen every 60 seconds
endif
if ModuloInteger(time,15) == 0 then
//do the actions that happen every 15 seconds
endif
//do actoins that happen every 5 seconds
endfunction
private function InitTrig takes nothing returns nothing
local trigger trg = CreateTrigger()
call TriggerRegisterTimerEvent(trg,5,true)
call TriggerAddAction(trg, function PERIODIC)
endfunction
endscope