unfortunately you still and still do not understand. yes, it does detect all entities, but from the list it chooses a random one.
as fast as i see my words dont help, maybe the code below will?
Code: Select all
function()
{
trig = getEnt("jump240_trig", "targetname");
while(1)
{
players = getEntArray("player", "classname");
for (i = 0; i < players.size; i++)
{
trig waittill ("trigger", user);
iprintln("caught "+user.name);
}
wait 1;
}
}
as you can see, function waittill() runs several times on one server frame (wait 0). according to you posts, is it supposed to print names of different players. i tested this function using two players. sometimes i was getting two identical names (both players had different names, obviously), and that means it caught the same player two times. just test this function, and you will be convinced of that.
without wait 1 the while(1) loop goes very fast: about 100 times per a second, although the minimal time is 0.05 (server fps were 20). it was really like 100-120, bcoz it reached 1000 within 10 seconds (i used a counter to check it).
i have also tested nightmare's code with 4 players, all of them were touching the trigger, and yes - each player was getting caught fast. but that happened, because the loop was going very fast - as i said, about 100 times per a second which makes the probability of getting caught pretty high (the array made of 4 players is too little). who knows what would happen if there were 20 players. can't test it, as my pc is too bad for running 20 copies of the game.
anyway you couldn't avoid having too many loops (100 per a second), so your code doesn't win.