Moving triggers.

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

Moderator: Core Staff

Post Reply
Fuzzmunch
CJ Wannabe
CJ Wannabe
Posts: 25
Joined: February 7th, 2008, 10:07 pm

Moving triggers.

Post by Fuzzmunch » February 10th, 2008, 5:28 am

Theres no errors or anything, but the trigger doesn't move. The trigger is a brush, and the triggerOrigin is a script_origin. Am I doing this right? Also why do I need the wait 0.05? (I saw this in the script in some topic.)

Code: Select all

main()
{
        thread triggerHurt();
}


triggerHurt()
{
	trigger = getent("triggerHurt","targetname");
	triggerOrigin = getent("triggerOrigin","targetname");
	trigger enablelinkto();
	trigger linkto(triggerOrigin);
	wait 0.05;
	while(1)
		{
			triggerOrigin movey(-500,5,0,0);
			triggerOrigin waittill("movedone");
			triggerOrigin movey(500,5,0,0);
			triggerOrigin waittill("movedone");
		}
}

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

Post by Drofder2004 » February 10th, 2008, 2:44 pm

The wait is so the server has one frames worth of time to link the entities, without it, it sometimes wont work.

The script looks fine, so what I would suggest is to make a brushmodel instead of a script_origin. This way you can physically see if it is working.
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

Fuzzmunch
CJ Wannabe
CJ Wannabe
Posts: 25
Joined: February 7th, 2008, 10:07 pm

Post by Fuzzmunch » February 10th, 2008, 6:31 pm

The brush moves, but the trigger doesn't.

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

Post by Nightmare » February 10th, 2008, 8:47 pm

Triggers do not move, you will have to link them to a script_brushmodel, not sure about an origin texture, you can use the nodraw-notsolid texture.
Also, make sure the wait is inside the loop.
Lastly! Make sure you have the map name in front of your targetnames to prevent conflicting.

Code: Select all

main()
{
        thread triggerHurt();
}

triggerHurt()
{
   trigger = getent("triggerHurt","targetname");
   triggerOrigin = getent("triggerOrigin","targetname");
   trigger enablelinkto();
   trigger linkto(triggerOrigin);
   while(1)
      {
         triggerOrigin movey(-500,5,0,0);
         triggerOrigin waittill("movedone");
         triggerOrigin movey(500,5,0,0);
         triggerOrigin waittill("movedone");
         wait 0.05;
      }
}
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]

Fuzzmunch
CJ Wannabe
CJ Wannabe
Posts: 25
Joined: February 7th, 2008, 10:07 pm

Post by Fuzzmunch » February 10th, 2008, 11:23 pm

I did link it to a script_brushmodel.
The brush moves, but the trigger doesn't.
I meant brushmodel, sorry.

I tried putting the wait inside the loop but it's still doing the same thing.
I don't get what you mean by putting the map name in front of my targetnames.

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

Post by Drofder2004 » February 11th, 2008, 1:05 am

If you are using a trigger_hurt I am not sure if it works.

Use a trigger_multiple.
then create a new thread with something similar to...

triggerMultiple ("trigger", user)
user.health-=5;
wait 0.05;
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

Fuzzmunch
CJ Wannabe
CJ Wannabe
Posts: 25
Joined: February 7th, 2008, 10:07 pm

Post by Fuzzmunch » February 11th, 2008, 3:31 am

Ok I switched to trigger_multiple and still the same, also the trigger takes my health down all the way but doesn't kill me. I even tried user.health = 0 and I'm still alive.

Code: Select all

main()
{
	level.trigger = getent("triggerMultiple","targetname");

	thread triggerMove();
	thread triggerMultiple();
}

triggerMove()
{
	triggerOrigin = getent("triggerOrigin","targetname");
	level.trigger enablelinkto();
	level.trigger linkto(triggerOrigin);
	wait 0.05;
	while(1)
		{
			triggerOrigin movey(-500,5,0,0);
			triggerOrigin waittill("movedone");
			triggerOrigin movey(500,5,0,0);
			triggerOrigin waittill("movedone");
			wait 0.05;
		}
}

triggerMultiple()
{
	while(1)
		{
			level.trigger waittill("trigger",user);
			user.health = 0;
			wait 0.05;
		}
}
EDIT: Also I got what nightmare meant from reading another post, and renamed my targetnames, but that didn't help.
EDIT2: I changed the trigger to a script_brushmodel and it moves with the triggerOrigin fine. :(

Fuzzmunch
CJ Wannabe
CJ Wannabe
Posts: 25
Joined: February 7th, 2008, 10:07 pm

Post by Fuzzmunch » February 11th, 2008, 9:53 pm

Yay I got it to work. I got desperate and just started trying random stuff. I put a wait 0.05 after every line and it worked, so I started taking them out until I found which line it was.

Code: Select all

trigger_origin = getent("map1_trigger_origin","targetname");
wait 0.05;
Im a little confused cause I've never seen anyone else need to do this, but whatever Im happy. :D
Also I changed it back to a trigger_hurt and it works just so you know.

Code: Select all

main()
{
	maps\mp\_load::main();
	thread trigger_move();
}

trigger_move()
{
	trigger = getent("map1_trigger_hurt","targetname");
	trigger_origin = getent("map1_trigger_origin","targetname");
	wait 0.05;
	trigger enablelinkto();
	trigger linkto(trigger_origin);
	wait 0.05;
	while(1)
		{
			trigger_origin movey(-500,5,0,0);
			trigger_origin waittill("movedone");
			trigger_origin movey(500,5,0,0);
			trigger_origin waittill("movedone");
			wait 0.05;
		}
}


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

Post by Drofder2004 » February 12th, 2008, 1:58 am

no problem. Like I said, sometimes the server requires a little extra wait for linking objects.
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

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests