env_beam is a point entity available in all Source games.
Start and end points should (ideally) be info_targets, though almost any entity is acceptable, with the exception of info_null (which is removed during map compile), and entities that cannot be named (prop_static, func_detail and prop_detail). If both / all start and end point entities are destroyed in-game, the beam will no longer work.
Developers can specify a group of multiple starting / ending entities by giving them the same name. The env_beam will then randomly select one of these entities to use for each strike. If entity names for either points is omitted, a random point on a solid surface within the radius (specified in its Radius property) will be selected for each strike instead. If both points are omitted, the center will be the env_beam entity itself. Such randomized beams do not cause damage.
The beam will always visibly run from start to end, even through solid brushes. However, beam damage will be absorbed by the first solid thing it hits, such as props, players, or solid brushes. When blocked in this manner, a striking env_beam (Life > 0) will immediately discharge all damage upon impact of each strike (which means that players can walk into a beam strike after impact and not take damage), while a permanent beam (Life = 0) will inflict damage gradually.
In code, it is represented by class
CEnvBeam, defined in
- Brightness (1 - 255)
- Beam brightness. Useless when set to 0.
- Beam Color (R G B)
- Beam color.
- If the LightningStart and/or LightningEnd values are omitted, this radius determines the area within which the endpoints will randomly strike. A new random position will be appointed for every strike.
- Life (seconds 0 = infinite)
- Amount of time before the beam dies. Setting to zero will make the beam stay forever.
- Width of beam
- Pixel width of the beam. Range: 1 to MAX_BEAM_WIDTH.
- Amount of noise (0-255)
- The amount of noise in the beam. 0 is a perfectly straight beam. Range: 0 to MAX_BEAM_NOISEAMPLITUDE.
- Sprite Name
- The material used to draw the beam.
- Texture Scroll Rate (0-100)
- Rate at which the beam texture should scroll along the beam. Range: 0 to MAX_BEAM_SCROLLSPEED.
- Frames per 10 seconds
- Framerate at which the beam texture should animate, if it has multiple frames.
- Starting Frame
- The frame to start the beam texture on.
- Strike again time (secs)
- Refire time between random strikes of the beam. Only used if the 'Random Strike' spawnflag is set.
- Damage / second
- How much damage this beam does per second to things it hits when it is continually on, or instantaneously if it strikes. For continuous damage, the value should be greater than 10 or it may not work.
- The "Easy" (
skill 1) setting causes 50% of the Damage / second value.
- The "Normal" (
skill 2) setting causes 100% of the Damage / second value.
- The "Hard" (
skill 3) setting causes 150% of the Damage / second value.
- Start Entity
- Entity that the beam starts at. If omitted the entity will instead use a random position on any surface within its Radius value. A new random position will be appointed for every strike. See usage note above.
- Ending Entity
- Entity that the beam ends at. If omitted the entity will instead use a random position on any surface within its Radius value. A new random position will be appointed for every strike. See usage note above.
- Decal Name
- Decal to be applied at the end of the beam
- HDR color scale.
- float value to multiply sprite color by when running in HDR mode.
- Touch Type (tripwire)
- If you want the beam to fire an output when touched by entities, choose the entity type here.
- 0 : Not a tripwire
- 1 : Player Only
- 2 : NPC Only
- 3 : Player or NPC
- 4 : Player or NPC or Physprop
- Filter Name
- Filter to use to see if activator triggers me. See filter_activator_name for more explanation.
- Endpoint handle
<vector>(New with Alien Swarm)
- If a LightningEnd entity is not specified, use this point as the destination instead. If the env_beam moves, the destination point will move along with it.
- Beam clipping
<choices>(New with Alien Swarm)
- Select whether you want the beam to clip against geometry or characters
- 0 : Do not clip (default)
- 1 : Clip to geometry
- 2 : Clip to everything solid
- Entity Scripts (vscripts)
<scriptlist>(New with Left 4 Dead 2)
- Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
- Script think function (thinkfunction)
<string>(New with Left 4 Dead 2)
- Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Note:Try to avoid expensive operations in this function, as it may cause performance problems.
- Render FX (renderfx)
- Preset pattern of appearance effects.
- 1 : Start On
- Starts the map with the beam turned on.
- 2 : Toggle
- Obsolete. Replaced by the Toggle input of the Source I/O system. Used to toggle the beam on and off.
- 4 : Random Strike
- When the beam has died, it will strike again randomly within a delay interval of 0 to the value in Strike again time (secs).
- 8 : Ring
- Uses the starting and ending points as a diameter, drawing a beam ring between them instead of a straight line.
- 16 : StartSparks
- Every time the beam strikes or is turned on, the beam temporarily emits a small shower of sparks at its Start Entity.
- 32 : EndSparks
- Every time the beam strikes or is turned on, the beam temporarily emits a small shower of sparks at its Ending Entity.
- 64 : Decal End
- Places a decal scorch mark where a damaging beam hits the first solid (world brush or entity). Refer to the "Decal Name" keyvalue to set the decal you wish to appear at the end of the beam.
- 128 : Shade Start
- The beam fades out toward its Start Entity. Overrides Shade End. Does not work on striking beams or beam rings.
- 256 : Shade End
- The beam fades out toward its Ending Entity. Is overridden by Shade Start. Does not work on striking beams (Life > 0) or beam rings.
- 512 : Taper Out
- Makes the beam taper out into a point towards its Ending Entity. Does not work on striking beams (Life > 0) or beam rings.
- Turns the beam on.
- Turns the beam off.
- Toggles the beam between on and off.
- Causes the beam to strike once. It will stay on for its set Life and then turn off (it will never turn off if Life is set to zero).
- Sets the beam's alpha (0 - 255).
- Sets the beam's render color (R G B).
- Sets the red color channel's value (0 - 255).
- Sets the green color channel's value (0 - 255).
- Sets the blue color channel's value (0 - 255).
- Set the amplitude of beam noise (0 - 255).
- Set the scroll speed in units per second (0 - 100).
- Set the width of the beam, in pixels.
- Removes this entity and any entities parented to it from the world.
- Functions the same as
Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster than
- Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
<script>(New with Left 4 Dead 2)
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
<string>(New with Left 4 Dead 2)
- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug: In , the code is executed in the script scope of the entity that fires the output, not the one receiving the input.Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
<string>(New with Left 4 Dead 2) !FGD
- Execute a VScript function in the scope of the receiving entity.
<coordinates>(New with Alien Swarm) !FGD
- Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
<angles>(New with Alien Swarm) !FGD
- Set this entity's angles.
- Move with this entity. See Entity Hierarchy (parenting).
- Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
- As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
- Removes this entity from the the movement hierarchy, leaving it free to move independently.
- Fired when an entity touches the beam. Only fired if the entity passes the 'Touch Type' choice.
- These Outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
OnKilled(Only in the Left 4 Dead series)
- This Output fires when the entity is killed and removed from the game.