Page 1 of 1
Moving triggers.
Posted: February 10th, 2008, 5:28 am
by Fuzzmunch
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");
}
}
Posted: February 10th, 2008, 2:44 pm
by Drofder2004
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.
Posted: February 10th, 2008, 6:31 pm
by Fuzzmunch
The brush moves, but the trigger doesn't.
Posted: February 10th, 2008, 8:47 pm
by Nightmare
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;
}
}
Posted: February 10th, 2008, 11:23 pm
by Fuzzmunch
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.
Posted: February 11th, 2008, 1:05 am
by Drofder2004
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;
Posted: February 11th, 2008, 3:31 am
by Fuzzmunch
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.

Posted: February 11th, 2008, 9:53 pm
by Fuzzmunch
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.
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;
}
}
Posted: February 12th, 2008, 1:58 am
by Drofder2004
no problem. Like I said, sometimes the server requires a little extra wait for linking objects.