Disable trigger

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

Moderator: Core Staff

Post Reply
BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Disable trigger

Post by BatterY » June 12th, 2010, 8:35 pm

How i disable trigger B, when trigger A is triggered?

Let's say we have a lift. The lift has 2 triggers: up and down. A player walks into the trigger A, which is down and the lift lowers. But a player walks into trigger B, which is up, causing the lift move back and forth. How to avoid this?

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

Re: Disable trigger

Post by Nightmare » June 12th, 2010, 11:06 pm

Simple:

Code: Select all

elevator(){
	trigDown = getent("triggerDown","targetname");	//Trigger to move elevator down
	trigUp = getent("triggerUp","targetname");	//Trigger to move elevator up
	ele = getent("elevator","targetname");		//Elevator
	while(1){
 		trigDown waittill("trigger");	//Wait until trigger down
		ele moveZ(-300,5,2.5,2.5);
		ele waittill("movedone");
		wait 5;
 		trigUp waittill("trigger");	//Wait until trigger up
		ele moveZ(300,5,2.5,2.5);
		ele waittill("movedone");
		wait 5;
	}
}
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]

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: Disable trigger

Post by BatterY » June 13th, 2010, 12:32 pm

Thanks, but i'm having another problem here: i need to disable the trigger while the thread is running.
So how i disable triggerUp while elevator() is running..?

Code: Select all

elevator()
{
trigUp = getent("triggerUp","targetname");
ele = getent("elevator","targetname");
while(1)
{
trigUp waittill("trigger");
ele moveZ(-300,5,2.5,2.5);
ele waittill("movedone");
wait 5;
ele moveZ(300,5,2.5,2.5);
ele waittill("movedone2);
wait 1;
}
}

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

Re: Disable trigger

Post by Drofder2004 » June 13th, 2010, 1:29 pm

Why disable it?

Nightmare posted a fine script to use.

The loop will stop and wait for the first trigger to be pressed and then after being pressed wait for the second trigger. Then restart.

Trigger A/B will only work once and only alternating.
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

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: Disable trigger

Post by BatterY » June 13th, 2010, 5:24 pm

I have 2 elevators in my map. other has 2 triggers, other has 1.
The other lift has only 1 trigger because its only one-way.

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

Re: Disable trigger

Post by Nightmare » June 13th, 2010, 7:04 pm

One time use elevator:

Code: Select all

elevator2(){
   trig = getent("trigger","targetname");   //Trigger to move elevator 
   ele = getent("elevator","targetname");      //Elevator
   trig waittill("trigger");   //Wait until trigger
   ele moveZ(-300,5,2.5,2.5);
   ele 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]

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests