CLightning (CS)

From AlliedModders Wiki
Jump to: navigation, search


Basic Information

  • Classname: CLightning.
  • Inheriting Instances: env_beam, env_lightning.
  • Description: Creates a laser or beam effect between two points.


Class Hierarchy


Entity Data

W = Windows | L = Linux

Name W. Offset L. Offset L. Diff Type Description
m_active 34 39 +5 int If beam should start on. ( used with SF_BEAM_STARTON spawnflag )
m_iszStartEntity 35 40 +5 int The name of the entity at which the beam will begin.
m_iszEndEntity 36 41 +5 int The name of the entity at which the beam will end.
m_life 37 42 +5 float Time for beam to stay on, in seconds. 0 is infinite.
m_boltWidth 38 43 +5 int Width of beam in (pixels*0.1). Range: 0-255.
m_noiseAmplitude 39 44 +5 int Amount of noise (NoiseAmplitude) - Range: 0-255.
m_brightness 40 45 +5 int Brightness. (renderamt)
m_speed 41 46 +5 int Texture Scroll Rate (TextureScroll) - How fast the texture should scroll along the beam. Range: 0-100.
m_restrike 42 47 +5 float Strike again time (StrikeTime) - How long to wait after the beam has turned itself off before it should start again, in 10ths of a second. Range: 0-255.
m_spriteTexture 43 48 +5 int Sprite index. ( from precache_model() )
m_iszSpriteName 44 49 +5 int Sprite Name (texture) - Name of sprite to use as beam's texture.
m_frameStart 45 50 +5 int Starting Frame (framestart) - Sprite animation frame at which to begin.
m_radius 46 51 +5 float Radius (Radius) - Noise radius.


Entity Attributes

  • Name (targetname) - Property used to identify entities.
  • Render FX (renderfx) - Gives objects special render effects. Think of it as modifying whatever the Render Mode puts out. The options are as follows:
0 = Normal
1 = Slow Pulse
2 = Fast Pulse
3 = Slow Wide Pulse
4 = Fast Wide Pulse
5 = Slow Fade Away
6 = Fast Fade Away
7 = Slow Become Solid
8 = Fast Become Solid
9 = Slow Strobe
10 = Fast Strobe
11 = Faster Strobe
12 = Slow Flicker
13 = Fast Flicker
14 = Constant Glow
15 = Distort
16 = Hologram (Distort and Fade)
  • Start Entity (LightningStart) - The name of the entity at which the beam will begin.
  • Ending Entity (LightningEnd) - The name of the entity at which the beam will end.
  • Brightness (renderamt)
  • Beam Color (rendercolor)
  • Radius (Radius) - Noise radius.
  • Life (life) - Time for beam to stay on, in seconds. 0 is infinite.
  • Width of beam (BoltWidth) - Width of beam in (pixels*0.1). Range: 0-255.
  • Amount of noise (NoiseAmplitude) - Range: 0-255.
  • Sprite Name (texture) - Name of sprite to use as beam's texture
  • Texture Scroll Rate (TextureScroll) - How fast the texture should scroll along the beam. Range: 0-100.
  • Frames per 10 seconds (framerate) - Framerate for sprite texture animation (0 is none)
  • Starting Frame (framestart) - Sprite animation frame at which to begin.
  • Strike again time (StrikeTime) - How long to wait after the beam has turned itself off before it should start again, in 10ths of a second. Range: 0-255.
  • Damage / second (damage) - Damage done to monsters / player when beam hits them.


Entity Flags

// Spawn Flags
#define SF_BEAM_STARTON		0x0001  
#define SF_BEAM_TOGGLE		0x0002
#define SF_BEAM_RANDOM		0x0004
#define SF_BEAM_RING		0x0008  // Forms a ring between the two targets.
#define SF_BEAM_SPARKSTART	0x0010
#define SF_BEAM_SPARKEND	0x0020
#define SF_BEAM_DECALS		0x0040  // Decals (bullet holes) appear where the beam hits objects.
#define SF_BEAM_SHADEIN		0x0080  // Start of beam fades away.
#define SF_BEAM_SHADEOUT	0x0100  // End of beam fades away.
#define SF_BEAM_TEMPORARY	0x8000


Notes

  • Info_target entities can be used as the beam start and end points when the Ring flag is off.
  • Only some point entities works as end and start points for beams with the Ring flag on.
    For example, monster_barney and weapon_rpg entities works, while light, info_target and path_corner entites does not.
    All brush entities with an origin brush works, though.
  • You can create moving beams by using func_trains as the targets, but they need an origin brush for the beam to aim at.
  • It is possible to have the beam target random points. If you leave the end entity undefined, the beam will fire from the start entity to a random direction until it hits a wall. This is very usefull for example on teleporters because you don't have to define loads of target points. If you leave both the start and end entity undefined, it will trace a line in a random direction from the actual env_beam entity for a start point and an another one from this point to get the end point. The beam will project between the points. This is totally random but could be used to create some kind of energy storm effect or something.


HLSDK Reference


Related Links