Basic Teleporter with Effects
Teleporters with sprite and sound effects are quite easy to construct.
First thing's first, make something that looks like a teleport pad. (Well, you don't need to, but come on, it's fun). Below you can see my attempt at making the pad. The main texture there is the C3A2_TELEPAD ... fitting, no?
The telepads in Half-Life also usually had some type of glowing sprite effect associated with them as well. We'll add that now too. Place an env_sprite a little above the telepad. For reference, in the example map there are 28 units between the top of the telepad and the center of the env_sprite. Below are the properties you'll need to set (those not mentioned can be left at their default).
- Render Mode (rendermode) - This should be set to Additive (5).
- FX Amount (renderamt) - This should be set to about 100. Higher, and the sprite will appear more solid; lower, less solid.
- Sprite Name (model) - I might be picky, but I like to use sprites/enter1.spr for the teleporter, and sprites/exit1.spr for the destination telepad.
- Scale (scale) - This is purely a matter of preference, but I think these sprites look best with a scale of 0.75.
- In the Flags properties, the Start On (1) flag should be set.
You should now have something similar to what's pictured below.
Ok, so now you have a pair of telepads (you made one for the destination too, right?) that look right, but that's about it. Before we go on to the actual teleportation effect, we'll setup a sound effect as well. Place an ambient generic above each telepad. Set their properties as outlined below.
- Name (targetname) - Set this to tele1_sound for both ambient_generic entities. They'll both be played at the same time.
- Path/filename.wav of WAV (message) - Again, the sound your teleporter makes is a matter of preference. I like to use debris/beamstart1.wav
- In the Flags properties, the Medium Radius (4), Start Silent (16), and Is NOT Looped (32) flags should be set.
Ok, now the secondary effects are in place. Time to move on to making this a working teleporter. This requires, for a start, two things - the trigger_teleport trigger area, and an accompanying info_teleport_destination which, of course, determines where the player will end up when he teleports.
Place the info_teleport_destination entity over the destination telepad. Set its angle to the direction you want the player to be facing after he teleports. Set the Name
) to tele1_dest
. That's the destination done with. Now, for the teleporter. Create a trigger_teleport brush directly over the telepad. Set its Target
) to tele1_dest
. For now, this is all you need to do, if you want to test that it works. If you compile and run this now, you will be able to walk into the teleporter and come out at the destination. However, the sounds won't be played. We'll cover this next. First, create a multisource entity somewhere close to the trigger_teleport brush. In the multisource properties, set the Name
) to tele1_master
. Now, in the trigger_teleport properties, set the Master
) to tele1_master
. This will make the trigger_teleport active only when the multisource state is on
(it starts off
If you tested the map now, nothing would work, because there isn't any way for the multisource to be turned on. To remedy this, create a multi_manager near the multisource. Give it a Name
) of tele1_mm
, then turn off SmartEdit and give it the following keys and values.
- tele1_sound with a value of 0
- tele1_master with a value of 0
- tele1_master with a value of 0.01 (will show up as tele1_master#1)
When its activated, the multi_manager will immediately activate the ambient_generic sound effects, while at the same time turning on the multisource. This will enable the trigger_teleport, teleporting the player to the destination. 0.01 seconds later, the multisource will again be activated, turning it off and disabling the trigger_teleport. The final thing we need to do is provide a trigger that will activate the multi_manager and get the whole thing rolling. Create a trigger_multiple in the same area as the trigger_teleport (see picture above). Set the Target
) to tele1_mm
. Set the Delay before reset
) to 0.5. This means that, every 0.5 seconds, the tele_mm multi_manager will get triggered (as long as the player is standing in the trigger). In practice, this means that the teleporter will be usable once every 0.5 seconds, since the player will not be standing in the trigger after it gets activated once.
So, to wrap it up, the events will occur as follows-
- player walks into the trigger_multiple trigger area
- the trigger_multiple activates the multi_manager
- the multi_manager:
- activates the ambient_generic entities, playing the teleport sounds
- activates the multisource, enabling the trigger_teleport which teleports the player to the info_teleport_destination
- activates the multisource again, disabling the trigger_teleport
- the player is left at the teleport destination
You might be wondering, why use a multisource to turn the trigger_teleport on and off? If you used the trigger_multiple to activate the ambient_generics, and layer it over the trigger_teleport, most of the time the trigger_teleport will take effect before the trigger_multiple notices the player. Setting it up the way its described in this tutorial allows you to easily add events to be triggered when the player teleports. For example, you might also want to use an env_fade to create a flash when the teleport takes effect.