an advice for triggers
Moderator: Core Staff
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: an advice for triggers
...
Ok, just to provide a little proof into your misunderstanding on this said "random event"...
I have adjust the codjumper mod to spawn 30 players (21 including myself). I have then created a map and a script that will move all players and drop them on to the top of a trigger.
The mod will also put a timescale of 0.5 to help show you what is being done...
Firstly: 30 people hit the trigger. All 30 names appear (I would assume in order of the for() loop).
Then, while ALL the bots and I are in the trigger zone, the mod will show a "iprintln()" of the name of the player being threaded on.
Now as you watch this video, please take note:
- There is no wait time between each player being captured by the trigger
- The multiple times the players are captured, at no time are they collected ina random order (the order repeats over)
- The "wait" between the prints are not only in 50% speed but also (I think) caused by the server refresh time, not the code).
http://www.megavideo.com/?v=9NPPNNC8
I hope you can finally understand, code is NEVER random.
Ok, just to provide a little proof into your misunderstanding on this said "random event"...
I have adjust the codjumper mod to spawn 30 players (21 including myself). I have then created a map and a script that will move all players and drop them on to the top of a trigger.
The mod will also put a timescale of 0.5 to help show you what is being done...
Firstly: 30 people hit the trigger. All 30 names appear (I would assume in order of the for() loop).
Then, while ALL the bots and I are in the trigger zone, the mod will show a "iprintln()" of the name of the player being threaded on.
Now as you watch this video, please take note:
- There is no wait time between each player being captured by the trigger
- The multiple times the players are captured, at no time are they collected ina random order (the order repeats over)
- The "wait" between the prints are not only in 50% speed but also (I think) caused by the server refresh time, not the code).
http://www.megavideo.com/?v=9NPPNNC8
I hope you can finally understand, code is NEVER random.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: an advice for triggers
Code: Select all
for (i = 0; i < players.size; i++)
{
trig waittill ("trigger", user);
iprintln("caught "+user.name);
}
but i was sometimes getting the same names. how can you explain it?
Re: an advice for triggers
maybe in cod4 waittill works in the right way.
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: an advice for triggers
Why are you looping the players when the players are automatically detected by the trigger?megazor wrote:here there is no time between being caught.Code: Select all
for (i = 0; i < players.size; i++) { trig waittill ("trigger", user); iprintln("caught "+user.name); }
but i was sometimes getting the same names. how can you explain it?
Only loop on players when you ar either running a check on them or if you wish to run a thread on the lot of em.
This has got nothing to do with CoD4, I learned my map based scripting in CoD1.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: an advice for triggers
i want the waittill to run as many times in one frame as how many players are there. should catch everyone who touches it, shouldn't it?Why are you looping the players when the players are automatically detected by the trigger?
Re: an advice for triggers
imagine the players amount is 5, then it is the same as for (i = 0; i < 5; i++)
so the waittill function runs 5 times.
according to what you wrote, waittill function has no wait time between each other, so it is the same as it was without the loop - i just use the loop for a handy check.
so the waittill function runs 5 times.
according to what you wrote, waittill function has no wait time between each other, so it is the same as it was without the loop - i just use the loop for a handy check.
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: an advice for triggers
"waittill" is its own wait timer. I do not know the exact limitations, but it will detect every trigger, I cannot tell you how it does it, but I know it does. It catches every player in a trigger multiple, you do not need to try and "improve" it by adding a more complex loop.
You for loop will do:
Loop 1:
Wait for trigger
Do something:
Loop 2:
Wait for trigger
Do something:
Loop 3:
Wait for trigger
Do something:
Loop 4:
Wait for trigger
Do something:
Loop 5:
Wait for trigger
Do something:
-> Stop
My way will do:
Loop 1:
Wait for trigger
Do something
-> go to loop 1.
The waittill function will detect any and every player that touches it and will loop as many times as it requires to, you do not need to set preferences.
You for loop will do:
Loop 1:
Wait for trigger
Do something:
Loop 2:
Wait for trigger
Do something:
Loop 3:
Wait for trigger
Do something:
Loop 4:
Wait for trigger
Do something:
Loop 5:
Wait for trigger
Do something:
-> Stop
My way will do:
Loop 1:
Wait for trigger
Do something
-> go to loop 1.
The waittill function will detect any and every player that touches it and will loop as many times as it requires to, you do not need to set preferences.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: an advice for triggers
please answer my question: why doesn't the code i posted choose different places constantly?
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: an advice for triggers
Not sure what you are trying to say?
If you are having problems with your code, don't use it. I have explained with good enough reasoning to show you why your code is wrong.
If you are having problems with your code, don't use it. I have explained with good enough reasoning to show you why your code is wrong.

Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 0 guests