WiseLaser

From Valve Developer Community
Revision as of 11:21, 21 February 2008 by Plykkegaard (talk | contribs) (→‎Moving Laser: change to use templates for entity description)
Jump to navigation Jump to search

Moving Laser

Moving Laser

In the image to the right the laser travels from both ends of that tunnel and will kill the player. I’ve placed the height so the player can jump over the laser each time. The player can not go under the laser at this height however.

There are several ways to create an effect like this, the settings and methods that is used in this tutorial can easily be changed to your liking. Notice the sprite placed on each side for a burning hot effect.

There’s a secondary ambient effect used in this tutorial, not related to the laser. A water puddle is created on the floor it will also make a splash sound.

An env_beam is used on each side of the tunnel to create the moving laser:

Class: env_beam
Keyvalues Comments
Parent Beam01train Right side parent equals Beam02train
Brightness 75
Beam Color 255 0 0
Life 0 (Infinite)
Width of Beam 0.7
Noise 0
Sprite name sprites/laserbeam.spr
Texture scroll rate 40
Damage 1000
Start Entity Beam01 Beam02 for the right side
Ending Entity Beam02 Beam01 for the right side
Touch Type Not a tripwire
Flag
Checkbox-on.png Start

Setup in Hammer

Setup in Hammer

To the right there's a shot from Hammer of the left side env_sprite, env_beam, func_tracktrain and first path_track.

Note.pngNote:The left and right sides are identical except for entity names.

Objects used

By looking at the image you can see the env_sprite is parented to the env_beam. The env_beam is parented to the invisible func_tracktrain. Our first path_track, the starting point, is nestled right in there with the other entities.

These are the settings for each env_sprite, which are only used for a slight effect.

Class: env_sprite
Keyvalues Comments
Parent Beam01 Beam02 for Right side
Render FX Normal
Render Mode Additive
FX Amount 150
FX Color 255 0 0
Disable receiving shadows Yes
Frame rate 10.0
Sprite name materials/sprites/glow03.vmt
Scale 0.2
Size of Glow 2.0
Flag
Checkbox-on.png Start

Settings for each func_tracktrain:

Class: func_tracktrain
Keyvalues Comments
Name Beam01train Beam02train for the Right side
Disable receiving shadows Yes
Disable Shadows Yes
First Stop Target Beam01path01 Beam02path01 for the Right side
Max speed 60
Initial Speed 60
Change Velocity Instantaneously
Change Angles Near path_tracks
Distance between the wheels 10
Height above the track 0
Bank angle on turns 0
Move sound d3_citadel.weapon_zapper_beam_loop1 Left side only
Volume 2
Flag
Checkbox-on.png No User Control
Checkbox-on.png Passable
Checkbox-on.png Fixed Orientation
Checkbox-on.png Is unblockable by Player

Path Tracks

Setup in Hammer

Notice in the image to the right that there are only 4 path_track’s. (Two on each side, for each func_tracktrain)

On the left side the first path_track references the second path_track which in turn references the first path_track, which causes the lasers on each side to go in a loop back and forth.

Settings for first path_track on the left side: Class: path_track

  • Name: Beam01path01 (Beam02path01 on the Right side)
  • Next Stop Target: Beam01path02 (Beam02path02 on the Right side)

By adding more of these path_track’s you could cause the laser to travel in a zigzag pattern. You could also attach multiple lasers to each side, for a double effect as an example.

As you can see the visual effect of the laser, it’s speed and the tiny sprite can all be changed to your liking.

Tip.pngTip:The reason I’m using a env_beam on each side rather than on one side only is I found the laser effect to be much better, you can experiment with this.

Water Puddle

The Water Puddle effect is done with an info_overlay.

Water Puddle

Class: info_overlay

  • Material: decals/decalborealispuddle001a

I’ve placed an env_cubemap over this, an ambient_generic for the sound and a trigger_multiple to play the sound when the Player steps there.

Class: ambient_generic

  • Name: WaterSound
  • Sound name: Water.StepLeft
  • Volume: 4
  • Flags:
  • Start Silent: Checked
  • Is NOT Looped: Checked

Class: trigger_multiple

  • Start disabled: No
  • Delay before reset: 1
  • Flags:
  • Clients: Checked
  • Everything: Checked
  • Output:
  • OnStartTouch, WaterSound, PlaySound

Laser turning a corner

Laser turning a corner

The trick to making the Laser turn a corner is to stop the inside train until the outside train catches up. Take a look at the Outputs for the path_tracks in the corner, should be straight-forward.

The next step is to make the Laser teleport to the first path_tracks so it can start over. To do that just check the flag Teleport to this path_track, in both of the first path_tracks.

The download for this tutorial contains two vmf projects. In the second example the Laser turns a corner and travels down another tunnel. Notice that I didn't use the sprites for this second example. Looked better without them.

Wrap up

There’s a lot more you can do, hopefully this article have stimulated your imagination.

Credits