If you play HL2DM or any other Death match type game you will have properly come across teleporters in the maps where when you walk through it you will be teleported to 1 of a few locations. In this tutorial I will explain the method how I have achieved this but there are properly other ways of doing it as well.
Setting the scene
Make you level with your teleporter and your destinations, not the actual entities yet just the brush work. Here's what I came up with, basic but fits the needs of the tutorial:
Adding the Entities
Now you should be ready to add all the entities into your map. In the tutorial I will be making it go to 1 of 3 locations but I will say how to work with more.
First place a
logic_case in your map. The
logic_case compares an input to up to 16 preset values. If the input value is the same as any of the preset values, an output corresponding to that value is fired.
For example: if
Case01 is set to
2 and
Case02 is set to
5, and the input value is 5, the
OnCase02 output will be fired.
This entity can also be used to select from a number of random targets via the
PickRandom input. One of the
OnCase outputs that is connected to another entity will be picked at random and fired. This is going to be how we will use it.
Give it these properties.
Name: random_picker
Case 01: change_to_dest_1
Case 02: change_to_dest_2
Case 03: change_to_dest_3
If you want more target just add
Case 04: change_to_dest_4 etc.
Now place a
logic_timer in your map. What this does is fires a timer event at regular, or random, intervals. For the property
use random time set it to
yes, just leave the name field blank as it will not be triggered.
Give it an output of
ontimer target
random_picker via
pick random.
Now make a brush and tie it to
trigger_teleport with
name of
teleporter. This is your teleporter, when a player walks through it they will be teleported to one of the locations.
Make 3 or however many you need
ai_changetarget and give them these settings:
name: change_to_dest_1
target entities: teleporter
new targets destination_1
name: change_to_dest_2
target entities: teleporter
new targets destination_2
name: change_to_dest_3
target entities: teleporter
new targets destination_3
Just use the same concept with any other you have.
Back at the
logic_case give it these outputs:
oncase01 target
change_to_dest_1 via output
activate
oncase02 target
change_to_dest_2 via output
activate
oncase03 target
change_to_dest_3 via output
activate
Add more to work with yours if you have more teleport destinations.
Now its time to add the
info_teleport_destinations. Give them these parameters:
name: destination_1
name: destination_2
name: destination_3
Same goes again, add more if you have more destinations.
And that's it; your random teleporter is finished. This is how my "finished" map looks like.
Just compile and run your map.