Page 1 of 1
Script keep track of game time?
Posted: Sun Nov 11, 2007 9:07 pm
by HDL_CinC_Dragon
Is it possible for the script to know how much time has gone by in the game? So can you have something like suddenly a wall falls down somewhere at like 0:3:30 minutes game time? or things like that?
Posted: Sun Nov 11, 2007 9:30 pm
by wacko
think there's loads of examples here in the forum. Why not use the search button and try to find things like clock, timer...
wait
Posted: Sun Nov 11, 2007 11:46 pm
by tltrude
Use "wait" and the number of seconds.
//----------------------------------------------------
Example:
wait 210
thread global/exploder.scr::explode 1
end
//----------------------------------------------------
You can also set a random wait time.
wait (randomfloat 180 + 240) // 3 to 4 minutes
Posted: Mon Nov 12, 2007 1:02 am
by HDL_CinC_Dragon
wacko wrote:think there's loads of examples here in the forum. Why not use the search button and try to find things like clock, timer...
I did a search for time and game time but got no hits related at all to what I needed. Guess I should have searched something else.
Thanks Tom, that is what im going to do.
Posted: Mon Nov 12, 2007 2:35 pm
by bdbodger
Not tested ingame but I think something like this would work
Code: Select all
main:
level waittill spawn
thread game_time
thread wall_fall
end
wall_fall:
while(1)
{
if (level.minutes == 3 && level.seconds == 30)
exec global/exploder.scr::explode 1
if (level.minutes == 5 && level.seconds == 30)
{
exec global/exploder.scr::explode 2
end
}
waitframe
}
end
game_time:
level.minutes = 0
level.seconds = 0
while(1)
{
wait 1
level.seconds++
if (level.seconds == 60)
{
level.minutes++
level.seconds = 0
}
}
end
Posted: Mon Nov 12, 2007 4:02 pm
by jv_map
Why not use
level.time ??
I recommend defining a level.starttime after level waittill spawn (dm matches) or level waittill roundstart (obj), e.g.
level waittill
spawn or
roundstart
level.starttime = level.time
and then at any later stage finding the
time after spawn or roundstart as:
level.time-level.starttime
