|
|
|
| |||||||||||||||||||
Moving Laser
Note: This tutorial has been updated, there are now two sample methods in the download below. In the image above 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 I’ve used in this tutorial can easily be changed to your liking. Notice that I’ve placed a sprite on each side for a burning hot effect. There’s a secondary ambient effect used in this tutorial, not related to the laser. On the floor I’ve created a water puddle that will also make a splash sound. To create the laser I’ve used an env_beam on each side of the tunnel: Class: env_beam Name: Beam01 (Right side name = Beam02) Parent: Beam01train (Right side parent = 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 Flags: Start On, Checked This is a shot from Hammer of the left side env_sprite, env_beam, func_tracktrain and first path_track. (The left and right sides are identical except for entity names.)
Transparent = func_tracktrain Purple = env_beam Green = env_sprite Red = path_track 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 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 Flags: Start on, Checked Settings for each func_tracktrain: Class: func_tracktrain 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 Flags: No User Control, Checked Passable, Checked Fixed Orientation, Checked Is unblockable by Player, Checked Notice in the image below 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. Note: 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. The Water Puddle effect is done with an info_overlay.
Class: info_overlay Material: decals/decalborealispuddle001a I’ve placed an env_cubemap over this, a 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 UPDATE: By request, the Laser turning a corner.
The download for this tutorial now 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. 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. |