WiseTele: Teleporting

From Valve Developer Community
Jump to navigation Jump to search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

Introduction

Teleports aren’t difficult to create and with a little imagination you can use them for interesting effects in your maps.

In this project the events are:

  1. Player starts out on Earth.
  2. Takes teleport form Earth.
  3. For 2 seconds is in a starfield.
  4. Ends up on the Moon.
  5. Can teleport directly back to Earth.

Creation

The teleport itself is a trigger, and is created like so:

  1. Create a normal brush textured entirely with tools/toolstrigger.
  2. Press Ctrl+T and select trigger_teleport from the list.
  3. Your new trigger_teleport doesn’t need any properties other than the Remote Destination.
  4. If you will be sending commands to this trigger_teleport then give it a name, otherwise don’t name it.

The Remote Destination can be either an info_teleport_destination or an info_target. I prefer to use the info_teleport_destination because it is more obvious when you are creating the map and you can preserve angles with it. Yes, preserve angles, to an extent. If you place the info_teleport_destination upside down the player will come through the teleporter upside down. The info_teleport_destination is placed in your map just like an info_player_start, it even looks the same.

You can add sound events to your teleporters by using a named ambient_generic. Assign a sound to the ambient_generic then create an output from the trigger_teleport.

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch Sound01 PlaySound 0.00 No

Also on your ambient_generic, check the Start silent and Is NOT looped flags. I haven’t used any sounds in this project but I would use custom sounds for any teleporters in an actual map.

In this project I’ve added an env_starfield for effect. I’ve also created a small, entirely black room outside the map for this env_starfield. The interior of the 144x144x144 room is textured with halflife/black. (Porter's note: I would recommend tools/toolsblack instead. It has no $surfaceprop, and VRAD won't waste time computing lighting for it.) I’ve placed an info_teleport_destination in this room and two triggers.

The first trigger is a normal trigger_multiple that enables the trigger_teleport.

Once the player is on the moon it’s important to stop the starfield at the right time or it will continue to show after the player has teleported. Just a simple matter of timing. The beams for the teleporters are an effect created with an env_beam. The target for each env_beam is an info_target, which is the same entity can can be used in place of the info_teleport_destination if you choose. Experiment with the properties on the env_beam, you can achieve just about any effect you need with these.

In this project what I’ve created for the teleporters on the ground is a mixture of brushwork and props. These are the properties for each of the groups in this project.

Earth

The trigger_teleport taking us to the starfield:

  • Start Disabled: No
  • Remote Destination: StarsDest
  • Flag: Clients
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch StarsTele Disable 0.00 No
Io11.png OnStartTouch Stars01 TurnOn 0.00 No

The info_teleport_destination for the Moon teleport:

  • Name: DestEarth

Starfield room

The trigger_multiple which enables the teleport trigger:

  • Start Disabled: No
  • Flag: Clients
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger StarsTele Enable 2.50 No

The trigger_teleport taking us to the Moon:

  • Name: StarsTele
  • Start Disabled: Yes
  • Remote Destination: DestMoon
  • Flag: Clients
  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnStartTouch Stars01 TurnOff 2.50 No

The info_teleport_destination for the Earth teleport:

  • Name: StarsDest

The env_starfield effect:

  • Name: Stars01

Moon

The trigger_teleport taking us to Earth:

  • Start Disabled: No
  • Remote Destination': DestEarth
  • Flag: Clients

The info_teleport_destination for the starfield teleport:

  • Name: DestMoon

If you are interested in creating random destinations for your teleports Edit Life has created a tutorial.

Update: I added two additional effects to the sample project below. Once you are on the moon all color will be gone and the gravity will be reduced.