Page 1 of 1

stop the stopwatch

Posted: Sun Jul 31, 2005 12:33 am
by ViPER
I want the stopwatch to run as long as one or more team members is in the trigger. I want it to break if they all leave the trigger or if an opossing team player enters the trigger?

Also -

while(1) the stopwatch keeps starting over every frame unless player leaves the trigger, how do i get just one trigger event per teams initial activation of the trigger?

Code: Select all

timer local.o local.sa local.sb local.m:

local.stopwtrg = spawn Trigger_multiple
local.stopwtrg.origin = ( local.o )
local.stopwtrg setsize ( local.sa ) ( local.sb )
local.stopwtrg targetname stopwtrg
local.stopwtrg setthread stopwtimer local.m

stopwtimer local.m:

while(1)
{
	$stopwtrg waittill trigger
	parm.other stopwatch local.m
}
end

Posted: Sun Jul 31, 2005 7:47 am
by bdbodger
the only thing is only one player can see your stopwatch . This will work for the way you have it .
stopwtimer local.m:

while(1)
{
$stopwtrg waittill trigger
local.player = parm.other
local.team = local.player.dmteam
local.player stopwatch local.m

level.team_check = 1
level.time_check = 1

thread team_check local.team
thread time_check local.m

while(level.team_check == 1 && level.time_check == 1) // wait while both are true
waitframe
}
end

team_check local.team:

while(level.time_check == 1) // loop while timer is running or untill team check fails
{
local.check = 0

for(local.i=0;local.i <= $player.size;local.i++)
{
if ($player[local.i] istouching $stopwtrg && $player[local.i].dmteam == local.team)
local.check = 1
}

if(local.check == 0) // team check fails
{
level.team_check = 0
end
}

waitframe

}

end

time_check local.m:

for(local.time = local.m;local.time > 0;local.time--)
{
if(level.team_check == 0)
goto end_timer // if team check fails goto label ending the time check

wait 1
}

end_timer: // this is a label inside a thread

level.time_check = 0

end

Posted: Sun Jul 31, 2005 10:23 am
by ViPER
TY bdbodger, i've been fooling around with this stopwatch so long I was about to scrap the idea. There is a problem with my script however, I'll try to get it working and if i cant in the next couple days ill post the whole thing.

text

Posted: Sun Jul 31, 2005 7:34 pm
by tltrude
You could also use hud draw to print the timer on everyones screen.

This was used to print countdown and health of a missle.

Code: Select all

	level waittill spawn

	level.misslehealth = 100 // percent
	level.missle_health = 8000  // trigger's health in the map.
	level.win_points = 300 // countdown in seconds.
	level.counter = level.win_points

//----------------------------------------------------------->
//   active scoreboard
//----------------------------------------------------------->

print_points:

	while (1) 
	{ 
	waitthread hudprint ("Countdown: " + (level.counter) + " seconds" + "\n" + "Missile health: " + (level.misslehealth) + " percent" ) .75 .65 .1  // three numbers are for color (gold)
	} 
 	waitframe
end

hudprint local.nstring local.r local.g local.b:

	huddraw_rect 187 140 -84 50 50 
	huddraw_color 187 local.r local.g local.b 
	huddraw_font 187 "facfont-20" 
	huddraw_string 187 local.nstring 
	huddraw_align 187 left bottom 
	huddraw_alpha 187 1

	wait .5 //refresh time 

end

Posted: Sun Sep 03, 2006 3:58 am
by «{T§F}»Puckeye
Could you tell me how huddrawm works?

I mean I know I could just copy and paste but I like to understand what the numbers are doing and sometimes trial and error just doesn't give all the answers... :)

Posted: Sun Sep 03, 2006 4:58 am
by tltrude
huddraw_rect 187 140 -84 50 50 // size on the screen
//the last four numbers are pixcles for the sides of a rectangle (box where things will be drawn).

huddraw_color 187 local.r local.g local.b // color of the text
//the last three variables (.75 .65 .1) are RGB numbers from the the thread above.

huddraw_font 187 "facfont-20" //game font to use

huddraw_string 187 local.nstring //string to print
//the variable is set in the thread above.

huddraw_align 187 left bottom // general location on the screen to place the box.

huddraw_alpha 187 1 // 1 means the background of the box is see-through.


That's all I can remember for now. There are more huddraw things that can be set.

Posted: Sun Sep 03, 2006 5:07 am
by «{T§F}»Puckeye
Thanks :)

What's the 187?

Some kind of ID for the huddraw position?

187

Posted: Sun Sep 03, 2006 10:17 am
by tltrude
Yes, I think so. It doesn't seem to matter what ID number is used, as long as it doesn't conflict with other huddraw IDs used in the game.

Posted: Sun Sep 03, 2006 10:46 am
by Rookie One.pl
Yeah, Tom's very right. :) It's the element number in an array of 256 (from 0 to 255). If you use the same ID for 2 different things, one of them is going to be overwritten.