Need a script

Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Need a script

Post by All-Killer » December 10th, 2006, 3:07 pm

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
Image

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » December 10th, 2006, 5:39 pm

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");
   }
}
}
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]

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » December 10th, 2006, 6:02 pm

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 :P
Image
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

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » December 10th, 2006, 6:09 pm

aha thanks i see, going to test it in a moment.

EDIT: oke doesnt work:

Image

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''
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » December 10th, 2006, 7:41 pm

Should it be if(players isTouching(trig)) ?
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

All-Killer
CJ Worshipper
CJ Worshipper
Posts: 383
Joined: December 16th, 2005, 6:38 pm

Post by All-Killer » December 10th, 2006, 7:45 pm

oke tested it but now a new error:

Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests