Tutorial: trigger_changetarget Last edited 4 months ago2024-08-06 19:57:53 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
In this tutorial I will explain what does this entity do, how to use it and demonstrate some of it's many uses. You should know how to use multi_managers for 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. If you don't know how to make teleporters then you should check Tutorial: Teleporters. Changing any object's target is exactly the same as changing a teleports destination (a path's target is the next stop target and that's the way to change a train/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 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_manager, I called it mm1. Make the multi_manager 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 instead of the trigger_changetargets, which changes the teleporter's destination, env_renders that one will make an object invisible and the other env_render will make it visible again.

Disabling Objects With multisources

multisources can be used to disable any object with a master value. If you disable a button or a door/rotating door it will sound it locked sound if you try using it. The thing won't move at all and the texture may change when it's disabled (if it can).
  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

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.

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.

2. 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 are two advantages for this method. The global can control entities across levels and it can activate more then one multisource at once you only need to give them all it's global state master.

Disabling Objects With A trigger_changetarget

You can also disable a few objects with the trigger_changetarget.
  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, the button will act normally (move, make the normal sound, the texture will change). Use this method if you want to disable buttons and triggers. Exceptions are: for 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 will just teleport you to the map's origin (0, 0, 0); a trigger_camera will just look at the origin position.

Examples

This contains everything done in this tutorial:
Loading embedded content: Vault Item #3480
Changing teleport destinations randomly:
Loading embedded content: Vault Item #5591
A guard who will only let you past in an H.E.V suit:
Loading embedded content: Vault Item #3187
Making multi-level elevators:
Loading embedded content: Vault Item #1482

Comments

You must log in to post a comment. You can login or register a new account.