Tutorial: Laser and Beam Effects Last edited 1 month ago2024-09-03 17:41:56 UTC

Download attachment

Remember, in Half-Life, after the accident, dodging broken lasers and huge bolts of lightning? And how about those rings of light that bounced up and down the columns in the Xen levels, or those rings around the electric pylon things during the intro? Well, it's quite easy to set up your own effects like those...

The Two Entities

This is one of those cases of having more than one entity that can be used for the same job. env_beam and env_laser are both able to create beam effects, but env_beam is the more versatile of the two. This tutorial explains the use of both entities.

env_laser

First, set up a room that you can place the entites in. Or it might be an idea to use the example map. You'll notice that I've placed one of those classic laser tubes across one end of the room, with a nick in it of course. Into the middle of the gap I have put an env_laser entity. Its target property is set to laser_targ, the name of a little func_train brush.

Notice that the func_train has an origin brush grouped with it - because the beam is targetting a brush-based entity, it has to have an origin. Just create a smaller brush textured in 'origin', place it in the middle of the larger brush, and group them. I've made the func_train invisible by setting Render Mode to Texture, but FX Amount is 1. I've also switched the Not Solid flag on, so that the player never gets to touch the train. The func_train then follows a path of path_corner entites in a never-ending cycle (if you're not sure how to create that, check out the elevator tutorial). Set to speed to whatever you want - I've made it 24 units per sec.

Back to the env_laser. Set Beam Color to whatever you want (I used red), and Noise to about 5. That parameter controls how much the beam jumps around. Leave the Sprite Name as sprites/laserbeam.spr, and set the Damage / Second to something nice and high. Flag-wise, make sure Start On is on, and you can set End Sparks and Decal End on as well for a nice effect.

You will find that although the laser starts up, it won't move until the train is triggered, so I have placed a trigger_auto in the room to trigger a multi_manager that has laser_targ as one of its targets (to create targets, turn off Smart Edit and add a keyvalue for each target - the key is the name of the target, and the value is the time to wait before triggering). The trigger_auto gets activated when the level loads, and it is set to wait 3 seconds before it triggers the multi_manager. You don't need a multi_manager unless you have more than one train to switch on (this map does, because of the other beam I'm about to discuss).

env_beam

For the second part of the tutorial, I am going to use an env_beam. These are more powerful than the env_laser, and can be used to create the same effects as them, as well as more. The first difference is that while the env_laser begins the beam right where the entity is, and targets something else, env_beam entities need to have a Start Entity and an End Entity target, which makes them more versatile (both targets can move, for example). They are also able to start and stop themselves at intervals, allowing for that lightning bolt effect that you often see in the game.

For this tutorial we're just going to make a beam bounce around the walls. First create two more func_train entities and paths, on opposite walls. I've called my trains beam1start and beam1end, and the paths are beamstart_x and beamend_x where x is the point number.

Now create an env_beam entity, and we can set it up. Start Entity and End Entity are the two trains, Beam Color in the example map is blue, Life is (infinite - stops the beam from turning on and off), Width of Beam is 25 and Noise, 15. Everything else is default. On the Flags sheet, Start On and Ring are turned on.

You'll need to add the two func_train entities to the multi_manager so that they start moving when the map loads.

Final Word

Run the map and wait for the beams to start moving - the ring effect is quite fun - adding a few more like that and making them bounce around each other would be cool. You might want to move the paths around to stop the ring from going through the walls, or you could turn the Ring flag off altogether (it still looks okay). By the way, rings of energy around cones / cylinders can also be created by placing a set of func_train targets around them, which I think is how it was done in the original, probably because the ring effect wasn't fully implemented (?). How about making the laser break down objects as it moves? There are two ways to do this - either trigger stuff to break (preventing the player from doing it with his weapon, but requiring good timing), or simply set the required damage so that the laser does it.
Death-tastic!Death-tastic!

5 Comments

Commented 13 years ago2011-01-26 04:54:17 UTC Comment #100487
how to make the laser enity + the target to move together ? for ex. enity on the left and the target on the right side and they move together along the wall across the room. i hope you understand me
Commented 13 years ago2011-01-26 05:20:21 UTC Comment #100488
bit 5 stars it works even on counter strike 1.6 :D
Commented 13 years ago2011-01-26 06:47:36 UTC Comment #100489
ok i all ready did it my self only with env_beam and 2 func_trains 4 patc_corners and 1 multi_maneger 1 trigger_auto for the test version
but i wouldent maked it with out this post thanks alot but i made some thing all most my self
Commented 13 years ago2011-01-29 19:27:52 UTC Comment #100490
can i make something like this that some one breaks a laser beam and then the laser beam starts something like a explosion.is it possible?
Commented 6 years ago2017-12-28 09:40:03 UTC Comment #100491
Is there a way to make a single laser beam that protects the reSPAWN that allows 1 team to go through and the other team dies , glows red , blue depending on the team color.

Would be similar to tripling that glows red , blue , but doesn't explode just sale the enemy team.

You must log in to post a comment. You can login or register a new account.