I want an event to occur 15 seconds before the end of my maps and not all of my maps have the same length.
Is there a way to watch timeleft? and if so how do i do that?
return value timeleft
Moderator: Moderators
not sure what the cvar for teh time is, maybe g_time?
i'll assume so..
Ok this is all theoretical, what it does is test the time vs the timeleft, or the time, put into negative, minus the maxtime. That'll return a positive value that SHOULD be the timelft..
Hey cool, this Math ain't so hard.
i'll assume so..
Code: Select all
if(g_time == g_timelimit - (g_time * -1))
{
//code
}Hey cool, this Math ain't so hard.
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
g_timelimit - (g_time * -1)
what's wrong with + ?
Anyway, a solid way to do it is the following:
Then at any moment you can get the time remaining by:
local.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
So if you want to have something happen at 15 secs before end best put it in a seperate thread:
This way it'll still work properly even if the user decides to change the roundlimit while playing (unless it is changed in the last 15 seconds).
what's wrong with + ?
Anyway, a solid way to do it is the following:
Code: Select all
level waittill roundstart // should already have this line
level.start_time = level.timelocal.time_remaining = level.dmroundlimit * 60.0 - level.time + level.start_time
So if you want to have something happen at 15 secs before end best put it in a seperate thread:
Code: Select all
somethread:
while(level.dmroundlimit * 60.0 - level.time + level.start_time > 15.0)
waitframe
// do what you have to do
end-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:


