Page 2 of 2

Re: an advice for triggers

Posted: June 9th, 2010, 8:52 pm
by Drofder2004
...


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.

Re: an advice for triggers

Posted: June 10th, 2010, 3:17 am
by megazor

Code: Select all

for (i = 0; i < players.size; i++)
{
               trig waittill ("trigger", user);
               iprintln("caught "+user.name);
}
here there is no time between being caught.
but i was sometimes getting the same names. how can you explain it?

Re: an advice for triggers

Posted: June 10th, 2010, 3:29 am
by megazor
maybe in cod4 waittill works in the right way.

Re: an advice for triggers

Posted: June 10th, 2010, 7:37 pm
by Drofder2004
megazor wrote:

Code: Select all

for (i = 0; i < players.size; i++)
{
               trig waittill ("trigger", user);
               iprintln("caught "+user.name);
}
here there is no time between being caught.
but i was sometimes getting the same names. how can you explain it?
Why are you looping the players when the players are automatically detected by the trigger?
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.

Re: an advice for triggers

Posted: June 10th, 2010, 10:31 pm
by megazor
Why are you looping the players when the players are automatically detected by the trigger?
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?

Re: an advice for triggers

Posted: June 10th, 2010, 10:35 pm
by megazor
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.

Re: an advice for triggers

Posted: June 11th, 2010, 2:31 am
by Drofder2004
"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.

Re: an advice for triggers

Posted: June 11th, 2010, 5:09 am
by megazor
please answer my question: why doesn't the code i posted choose different places constantly?

Re: an advice for triggers

Posted: June 12th, 2010, 3:56 pm
by Drofder2004
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.