Snarkpit Articles


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.


Post ReplyView Topic
Discussion
0 starsPosted by Grash on Fri Aug 26th 2005 at 9:25pm

One minor point. If you are just using the logic_case to pick something at random, then it doesn't really matter what are the values you put in, as long as the cases you are using have a value there. Beyond that, great tutorial.
0 starsPosted by Forceflow on Fri Jul 8th 2005 at 8:56pm

It's fairly the same as in HL1, good job anyway.
0 starsPosted by Paladin[NL] on Thu Jun 23rd 2005 at 11:11am

After reading it and trying it out, I'd say well done.
0 starsPosted by habboi on Tue Jun 21st 2005 at 11:09am

Very helpful!
I needed to figure that out so thanks smiley
0 starsPosted by Darth Kristofer on Sat Jun 18th 2005 at 6:03am

I'm not experianced with the logic entities yet, but now I can make random teleport points and I just tried it with audio! Thanks.
Post ReplyView Topic