Page 1 of 1
Need a script
Posted: December 10th, 2006, 3:07 pm
by All-Killer
Hi, i need a really special script. This is what i want. I want a script that constantly checks if someone is touching the trigger. And if some one touch it a door will be closed. I think drofder knows a way.
Thanks in advance
Posted: December 10th, 2006, 5:39 pm
by Nightmare
I will give it a shot, I asked for a script like this a while ago
Code: Select all
trig_check()
{
door = getent ("door","targetname");
trig = getent("trig_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;
}
else
trig.touch = false;
}
if(trig.touch == true)
{
iprintlnbold("Trigger is being touched"); //Debugging, remove later when it works
door moveto ((0, 0,0), 1,0,0);
door waittill ("movedone");
}
if(trig.touch == false)
{
iprintlnbold("Trigger is not being touched"); //Debuging, remove later when it works
door moveZ (-128,2,0.5,0.5);
door waittill ("movedone");
}
}
}
Posted: December 10th, 2006, 6:02 pm
by Drofder2004
Theres possibly a slightly edasier version of the script above, but unless the one above does not work (which I cannot see why it shouldn't), then I wont be posting

Posted: December 10th, 2006, 6:09 pm
by All-Killer
aha thanks i see, going to test it in a moment.
EDIT: oke doesnt work:
Im not the best in scripting so this is what i did.
The door i gave a targetname ''door'' and the trigger that needs to check it: ''trig_check''
Posted: December 10th, 2006, 7:41 pm
by Luke
Should it be if(players isTouching(trig)) ?
Posted: December 10th, 2006, 7:45 pm
by All-Killer
oke tested it but now a new error:
