Tutorial: Laser and Beam Effects
Last edited 9 months ago2019-04-22 07:02:58 UTC by
- View Page
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.
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).
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 0 (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.
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.
You must log in to post a comment.
You can login or register a new account.