Drof can find this (probably)
Moderator: Core Staff
Drof can find this (probably)
Ok, so I need a script which will work like this:
I need something where a trigger multiple can be smart enough to know when there is no one in that trigger multiple
Ex: 3 people are in a room, all 3 of them die and something will happen, how could this be done?
I need something where a trigger multiple can be smart enough to know when there is no one in that trigger multiple
Ex: 3 people are in a room, all 3 of them die and something will happen, how could this be done?
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Code: Select all
trig = getent("trigger","targetname");
trig.touch = false;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(player[i] isTouching(trig))
{
trig.touch = true;
break;
}
else
trig.touch = false;
}
if(trig.touch == false)
{
//Do stuff here
}
}
It scans all the players on the server (players) and checks if they are touching the trigger.
If a single person is touching the trigger, the scanning will stop. If nobody is touching the trigger after the scan then the scan will also stop. Depending on the outcome of the scan a variable is set (trig.touch) which is where the 'If' statement checks it, if it is false (nobody is touching it) then that is where you do what you want, else the loop will start again and the players will be scanned.

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
awsome thanks 
so lets say I wanted to make a wall move, I would do:
right?[/code]

so lets say I wanted to make a wall move, I would do:
Code: Select all
wall = getent("wall",targetname");
trig = getent("trigger","targetname");
trig.touch = false;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(player[i] isTouching(trig))
{
trig.touch = true;
break;
}
else
trig.touch = false;
}
if(trig.touch == false)
{
wall moveX (bla,bla,bla);
}
}
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
ok, I got it working, but I also want it to keep on checking after it does the scan, so I would like it to scan nonstop that way it can work for multiple rounds without having to restart the map.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Hmm. It should already loop constantly...Nightmare wrote:ok, I got it working, but I also want it to keep on checking after it does the scan, so I would like it to scan nonstop that way it can work for multiple rounds without having to restart the map.
have you threaded it from main?
It might be that the "break;" is breaking both the for and the loop. Set up some "iprintln" commands at every instance... inside the if statements, before the break; line and just outside of the for loop...
Then tell me where exactly it stops looping.

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
heres what I got:
By the way, this script starts checking at the begening right when I connnect, so it doesnt even leave me any time to get in the trigger. Afterwards after the movements have been done, and no one is in the trigger, the loop will not start over again.
Code: Select all
main()
{
thread nm_rain_start();
thread nm_rain_tele();
}
nm_rain_start()
{
wall = getent ("nm_rain_start_wall","targetname");
nd = getent ("nm_rain_nd","targetname");
trig = getent("nm_rain_check","targetname");
trig.touch = false;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(player[i] isTouching(trig))
{
trig.touch = true;
break;
}
else
trig.touch = false;
}
if(trig.touch == false)
{
iprintlnbold("10 Seconds until start");
wait(5);
iprintlnbold("5 Seconds until start");
wait(5);
iprintlnbold("^1Ready");
wait(1);
iprintlnbold("^3Set");
wait(1);
iprintlnbold("^2Go!");
wait(0.25);
wall moveZ (-128,2,0.5,0.5);
wall waittill ("movedone");
wait(1);
nd moveX (200,1,0.5,0.5);
nd waittill ("movedone");
wait(1);
wall moveZ (128,1,0.5,0.5);
wall waittill ("movedone");
wait(0.5);
nd moveX (-200,1,0.5,0.5);
nd waittill ("movedone");
}
}
}
nm_rain_tele()
{
use = getent("nm_rain_switch","targetname");
multiple1 = getent("nm_rain_tele1","targetname");
multiple2 = getent("nm_rain_tele2","targetname");
loc[0] = (-576,1200,656);
while(1)
{
use waittill ("trigger",user);
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(players[i] isTouching(multiple1))
{
players[i] setOrigin( (-864, -64,-2552) );
}
else
if(players[i] isTouching(multiple2))
{
players[i] setOrigin( (64, -64,88) );
}
wait(3);
}
}
}
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Run this code on its own...
If the code above stops looping and you see the message in red caps, then try this...
Change the "while(1)" to "while(loop == 1)"
and just above that add a line "loop = 1;"
Code: Select all
nm_rain_start()
{
trig = getent("nm_rain_check","targetname");
trig.touch = false;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(player[i] isTouching(trig))
{
trig.touch = true;
iprintln("Touch = " + trig.touch + " loop break...");
break;
}
else
iprintln("Touch = " + trig.touch + " loop continue...");
wait 0.5;
}
iprintln("Checking IFs...");
wait 0.5;
if(trig.touch == false)
iprintln("Touch = false");
else if(trig.touch == true)
iprintln("Touch = true");
else
iprintln("Touch = no result?");
wait 0.5;
iprintln("end of loop");
}
wait 0.5;
iprintln("^1IF YOU SEE THIS MESSAGE WE HAVE A PROBLEM"); // ;)
}
Change the "while(1)" to "while(loop == 1)"
and just above that add a line "loop = 1;"

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
I think I found out what the problem is with the script. I gave the one I made a try and it will work when it sees that no one is in the trigger. and it will keep relooping after the movments are completed, now when I walk into the trigger, the whole loop will stop completly and it will not check itself again to see if anyone is in it.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Use my code, and tell me what message it ends on, this way I can find the problem really easily.Nightmare wrote:I think I found out what the problem is with the script. I gave the one I made a try and it will work when it sees that no one is in the trigger. and it will keep relooping after the movments are completed, now when I walk into the trigger, the whole loop will stop completly and it will not check itself again to see if anyone is in it.

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
the message says touch = true non stop even when im not in the tirgger box...
can you get on msn? this would be alot easier.
can you get on msn? this would be alot easier.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Try this code. Do not touch the trigger at all. the code will take 5 seconds from the map starting to kick in.
If the trig is still saying its being touched even if you have not touched it, then there is a problem.
If the trig is still saying its being touched even if you have not touched it, then there is a problem.
Code: Select all
nm_rain_start()
{
trig = getent("nm_rain_check","targetname");
trig.touch = false;
wait 5;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(isAlive(players[i]) && players[i] isTouching(trig))
{
trig.touch = true;
iprintln("Touch = " + trig.touch + ":: Trig touched by " + players[i].name);
break;
}
else
iprintln("Touch = " + trig.touch + " loop continue...");
wait 1;
}
iprintln("Checking IFs...");
wait 1;
if(trig.touch == false)
iprintln("Touch = false");
else if(trig.touch == true)
{
iprintln("Touch = true");
trig.touch = false;
}
else
iprintln("Touch = no result?");
wait 1;
iprintln("end of loop");
}
wait 1;
iprintln("^1IF YOU SEE THIS MESSAGE WE HAVE A PROBLEM"); // ;)
}

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
ok now its working fine
what did you do to it? :p
and now, where do I put the movement commands because this looks alot more complicated
what did you do to it? :p
and now, where do I put the movement commands because this looks alot more complicated
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
I forgot to reset the trig.touch variable and I also made it so it checked if the player was alive.Nightmare wrote:ok now its working fine
what did you do to it? :p
and now, where do I put the movement commands because this looks alot more complicated
Code: Select all
nm_rain_start()
{
trig = getent("nm_rain_check","targetname");
trig.touch = false;
wait 5;
while(1)
{
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
if(isAlive(players[i]) && players[i] isTouching(trig))
{
trig.touch = true;
break;
}
}
wait 0.1;
if(trig.touch == false)
{
//This is when a player is not touching the trig
}
else if(trig.touch == true)
{
//This is where if there is at least 1 player touching the trig
trig.touch = false; // This must be the last line of this 'if'
}
wait 0.5;
}
}

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
ah, it works like a charm! 
Thanks so much drof. I will be putting it on my server soon

Thanks so much drof. I will be putting it on my server soon
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet
-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]
Who is online
Users browsing this forum: No registered users and 1 guest