Page 2 of 2
Posted: Wed Jun 09, 2004 8:41 pm
by jv_map
Yes you can glue it very tight

Posted: Wed Jun 09, 2004 8:53 pm
by oddball
i was thinking, i'm using if (isalive($player[local.p]) if it wouldn't be better to use while (isalive $player[local.p]
the if statement if only accessed while checking, if i add a while for each player, it scans all the time, or am i wrong in this ?
besides that 32 while loops, would that give a high server load ?
what you think is the best? while or a trigger ?
Posted: Tue Jun 15, 2004 3:41 pm
by oddball
ok, after some searching i added this to my script
Code: Select all
start:
for (local.h = 1; local.h <= $player.size; local.h++)
{
level.num = int(local.h)
thread playertrigger $player[local.h]
}
end
and:
Code: Select all
playertrigger local.player:
level.trigger[level.num] = spawn trigger_use
level.trigger[level.num].origin = $player[level.num].origin
level.trigger[level.num] setsize ( -50 -50 -50 ) ( 50 50 50 )
level.trigger[level.num] glue local.player
end
So this means it spawned triggers for every player.
now the question,
how can i get the state of the trigger in an "if" statement?
something like : if trigger = 1 bla bla bla..
if possible, i don't want to use the waittill trigger
Posted: Tue Jun 15, 2004 5:39 pm
by tltrude
if (level.trigger[level.num] == 1)
But, level.num must have a value or it will just use the last number it was set to.
if (level.trigger1 == 1)
if (level.trigger2 == 1)
if (level.trigger3 == 1)
Posted: Tue Jun 15, 2004 6:36 pm
by oddball
thanks,
Yes i know, i have another thread where it comes back and picks it up
Posted: Wed Jun 16, 2004 9:56 am
by jv_map
You will have to use waittill trigger I'm afraid

... however it's quite easy to work-around it:
Code: Select all
$mytrigger thread watchtrigger
// ---
watchtrigger:
self wait 0.05 // trigger every frame
while(self)
{
self waittill trigger
self.lasttriggertime = level.time
}
end
isbeingtriggered:
end (level.time - self.lasttriggertime <= 0.10)
With this bit of code you can do neat things, i.e. call the watchtrigger thread once and after that you can simply do:
Code: Select all
if ($mytrigger waitthread isbeingtriggered)
{
// etc
}

Posted: Wed Jun 16, 2004 1:33 pm
by oddball
hmmm, interesting, will give it a try