Hello guys I would like to know how to make this timer pick among 4 different functions.
Right now the timer is set to spawnObj1 as the function
spawnTimer = timer.performWithDelay( 5000, spawnObj1, 1 )
Hello guys I would like to know how to make this timer pick among 4 different functions.
Right now the timer is set to spawnObj1 as the function
spawnTimer = timer.performWithDelay( 5000, spawnObj1, 1 )
You could set the timer to call a function that then does the picking, for instance,
local function pickFunction() local int = math.random(4) if int == 1 then spawnObj1() elseif int == 2 then spawnObj2() elseif int == 3 then spawnObj3() else spawnObj4() end end spawnTimer = timer.performWithDelay( 5000, pickFunction, 1 )
You could set the timer to call a function that then does the picking, for instance,
local function pickFunction() local int = math.random(4) if int == 1 then spawnObj1() elseif int == 2 then spawnObj2() elseif int == 3 then spawnObj3() else spawnObj4() end end spawnTimer = timer.performWithDelay( 5000, pickFunction, 1 )