Snarkpit Articles


trigger_changetarget



In this tutorial I will explain what does this entity does, how to use it, and demonstrate some of its many uses. You should know how to use multi_managers as we are going to use them a lot. The trigger_changetarget simply changes entities' targets and it is easily configured.


How to use the trigger_changetarget



This section is going to show how to change a teleport's destination. Changing any object's target is exactly the same as changing a teleports destination (eg. a path_corner/path_track's target is the next stop target and that's the way to change a func_train/func_tracktrain's path).

1) Create your trigger_teleport. I called it tele1.
2) Give the teleport a destination. I called the info_teleport_destination des1. Copy the destination and place it somewhere else in the map. I called the second destination des2. The trigger_teleport must target the first destination and not the second one.
3) Create your trigger_changetarget give it a name, in my case tct1. Make it target the trigger_teleport tele1 and in the 'new target' field write the name of the second destination des2. The target value is which entity's target is going to be changed and the new target value is which entity will be the targeted entity's new target.
4) Make a button/trigger(by that I mean a target_button/func_button/func_rot_button/trigger_once/trigger_multiple) that will target that trigger_changetarget.

When you will activate the trigger_changetarget it will change tele1's target to des2 but it can't be changed back to des1. In the next section I will show you how to make this process repeatable.



How to make the process repeatable



1) Create a multi_manger, I called it mm1. Make the multi_manger target tct1.
2) Create another trigger_changetarget and name it differently then the first one; I called it tct2. Make tct2 target the trigger_teleport ,tele1, and in the new target value write the name of the first info_teleport_destination des1.
3) Target tct2 with a second multi_manager, I called it mm2.
4) Name the button/trigger, I called it tele_button.
5) Create another trigger_changetarget, I called it tct3, make it target the button/trigger and make it change the button/trigger's target to the second multi_manager, mm2. Target tct3 with mm1.
6) Create another trigger_changetarget, I called it tct4, make it target the button/trigger and make it change the button/trigger's target to the first multi_manager mm1. Target tct4 with mm2.
7) Make the button/trigger target mm1 instead of tct1 (you can't use trigger_once if you want it to be repeatable).

We have a button/trigger that targets a multi_manager. This multi_manager targets a trigger_changetarget that changes the teleport's destination, and another trigger_changetarget that changes the button/trigger's target to a second multi_manager. The second multi_manager targets a trigger_changetarget that changes the teleport's destination back to the original one, and another trigger_changetarget that changes the button/trigger's target to the first multi_manager. This way you can make things that aren't repeatable, if you just target them, repeatable. For example make the multi_managers target env_renders instead of the trigger_changetargets (which changes the teleporter's destination) and you can make an object invisible and the other env_render will make it visible again.

To add more destinations Just make the trigger_changetarget that changes the button's target back to the first one change the button's target to a third multimanager. That multimanager will target also two trigger_changetargets, one will change the teleport's destenation and the second will change the button's target to the first or a forth one... and so on!


Disabling Objects With multisources



multisources can be used to disable any object with a master value. If you disable a button or a func_door/func_door_rotating it will sound it locked sound if you try using it. The entity won't move at all and the texture will change when it's disabled(If the entity is using a togglible texture).

1) Create your door.
2) Create a multisource. In the door's master value write the name of that multisource.
3) Create a button/trigger that will target the multisource.

Easy, isn't it? When the multisource is off you wont be able to open the door. The only problem is that if you going to target the multisource with more then one object you'll have to activate all the objects only then it will be triggered. There are two ways to fix this:

First Way

1) Make all the object that you want to target that multisource target a trigger_relay and make it target that multisource. You can set the trigger state if you want, off means it will only turn things off, on means it can only turn things on and toggle means it can only toggle things between on and off.

This way we made only one object trigger that multisource while all the other objects trigger it. If you will use a multimanager you can make the multimanager target many multisources at once.

Second Way

1) Create an env_global, name it, I called it dr_global, and make all the objects target it. In the global state to set value write anything that you want but make sure no other global has this global state, I wrote door_global. The trigger mode value has four options that

you can choose from:
- Off: the global will only toggle things off.
- On: the global will only toggle things on.
- Toggle: the global will toggle things from off to on or on and the opposite.
- Dead: for use with monsters.
The initial state value means that if the set initial state flag is ticked the global will start in the state you chose.
In the multisource's global state master value write the env_global's global state, door_global.

When the global is on the multisource will be on too and the opposite. There is one advantages for this method. The global can control entities across levels! Giving more multisources the same global state master makes the global control them all.


Disabling Objects With A trigger_changetarget



You can also disable a few objects with the trigger_changetarget, like buttons and triggers.

1) Create a button/trigger, name it, I called it lswitch, and give it a target, I targeted a light entity called light with it.
2) Create a trigger_changetarget, name it, I called it ltct1. Target the button with ltct1 and don't give it a new target.
3) Create another button/trigger and make it target the trigger_changetarget. Cause I wanted this button to shut down the power I also added a trigger_relay that it's trigger state is off and made it target the lights so every time I turn off the power the lights will turn off.

The trigger_changetarget changes the button's target to nothing so it wont activate a thing, buttons will act normally (move, make the normal sound, the texture will change). Use this method if you want to disable buttons and triggers. (not doors, trains, only stuff that trigger other things) Exceptions are: trigger_once for the trigger still works it just does nothing so after the first time it's triggered it won't be triggered again; trigger_teleport and the trigger_camera will not work either.

In the example map I made it repeatable, thats why you'll find two trigger_relays in there. One turning on and the other off.


Making multi-level elevators



I will show you how to make these now. Elevators that have more then two stops.

1) Create your elevator. Make it a simple 2 stop elevator- the first path target the second one and the second one targets the first.
2) Create another path that will be the third stop, don't target it with any path but make it target the second one.
3) Create two trigger_changetargets, make them both target the second path. Make one change the path's target to the lower path(I'll call this trigger tctlow) and the other will change the path's target to the higher
Path.(I'll call this trigger tcthigh)
4) Create two multi_managers. One will target tctlow and after a short time will target the elevator.(I'll call the multi_manager mmlow) The other one will target tcthigh and after a short time it will target the elevator.(this multi_manager I'll call mmhigh)
5)Create two buttons in the middle floor. The one that will make the elevator move up will target mmhigh and the other will target mmlow.

One of the buttons target a multimanager that targets the elevator(usually a func_train) and a trigger_changetarget. That trigger changes the path's target to a different path. The other button targets another multimanager that activates the elevator and another trigger_changetarget.

That trigger changes the path's target back. If you're in the middle but the elevator isn't just press one of the buttons. It will be activated, the fact that the path's target changes only matters if it moves from there. Make sure you tick the 'wait for retrigger' flag in the path's flags, or else it wont stop in that path.

If you don't understand anything here - check the example map, I did in there everything done in here, step by step... except for the last section (sorry for that)!

Example map http://twhl.co.za/mapvault_map.php?id=3480&dl=1


Post ReplyView Topic
Discussion
0 starsPosted by Le Chief on Fri Aug 25th 2006 at 9:30pm

Crap I think I spelt entite wrong Dam It. Good tut.
0 starsPosted by Le Chief on Fri Aug 25th 2006 at 9:29pm

I had no idea what this entite did. But now I do So thanks. Lol look at Orpheus first comment. Thats Funny. "Stupid ass". Good on ya mate.
0 starsPosted by Orpheus on Sun Mar 19th 2006 at 11:14pm

[author]
Posted by Elon Yariv on Sat Mar 18th 2006 at 10:46am

Ok I'll do it. Very nice idea.
0 starsPosted by The_6th_monkey on Thu Mar 16th 2006 at 12:57pm

I actually mean't a seperate example map for each section of the tuturial so the user doesn't have to look around the one example map searching all the entitties to find out which area he/she needs. A link to each small example map could be pasted under each tuturial as well so they can read then click and so on. Would just make the tuturial a little more user freindly although its still good smiley
[author]
Posted by Elon Yariv on Tue Mar 14th 2006 at 3:04pm

The example map at the end covers everything.Except the last section that I'm adding now.

Which areas do you mean? I can always edit! smiley
0 starsPosted by The_6th_monkey on Tue Mar 14th 2006 at 12:31pm

Great tuturial about an incredibly useful entity that is underused. I actually taught myself about this entity because of the lack of tuturials.

About the pictures..I personally don't think pictures would help this tuturial. Although everyone has their views. Anyhow great tuturial good job.

Only problem is I feel you may of over complicated a few areas which could of been achieved more efficiently

..and I think instead of pics, small example maps for each section would be more useful in this kind of tuturial smiley
[author]
Posted by Elon Yariv on Mon Mar 13th 2006 at 4:54pm

I'll add some drafts to the text then.

Edit:

Damn... it's really hard to make the draft to the second one!

Edit #2:

Errr... I don't think I'll make a draft for the second one it will be really complex... oh well, it will be better then nothing.
0 starsPosted by ReNo on Mon Mar 13th 2006 at 4:00pm

I agree, it might be hard to find truly useful pics, but even if they can help put something into context, they will be worth it. They really do break up the text and make the tutorial easier to follow and less daunting to read.
[author]
Posted by Elon Yariv on Mon Mar 13th 2006 at 11:00am

Err... what for? The tutorial is on entities not something brush based! smiley

Well ok. I'll add a few screenies after I'll finish updating the example map. They'll make it easier for the eye and thus easier to read this tutorial.
Post ReplyView Topic