point_spotlight

From Valve Developer Community
Jump to: navigation, search

point_spotlight is a point entity available in all Source games. It is a light_dynamic with two glow sprite effects: a beam effect for viewers outside the light cone and a halo effect for viewers inside the cone.

  • If the 'No Dynamic Light' spawn flag is checked this entity will just provide a sprite effects, and will not illuminate other objects.

By default point_spotlight is told to use the material sprites/glow_test02.vmt. You can change this if you are shipping your own binaries by going into point_spotlight.cpp in the server project, navigating to line 351 and replacing:

m_hSpotlight = CBeam::BeamCreate( "sprites/glow_test02.vmt", m_flSpotlightGoalWidth );

There you can define your own material.

To do: Define a way to set a custom materials through this ents keyvalues


A point_spotlight.

Keyvalues

Spotlight Length <integer>
Length of the spotlight beam.
Spotlight Width <integer>
Width of the spotlight beam.
Color (R G B) <color255>
Spotlight color.
HDR color scale. <float>
float value to multiply sprite color by when running in HDR mode.
Halo size scale. <float> (New with Left 4 Dead 2)
float value to determine the size of the halo.

Targetname:

Name <string>
The targetname that other entities refer to this entity by.
Entity Scripts <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 <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.

Parentname:

Parent <targetname>
Specifies a movement parent. An entity will maintain its initial offset from its parent. An attachment point can be added to the end of the name, separated by a comma.

RenderFields:

Render Mode (rendermode) <choices>
Set a non-standard rendering mode on this entity.
Render FX / Transparency (0 - 255) (renderamt) <integer>
Transparency amount, requires a Render Mode other than Normal. 0 is invisible, 255 is fully visible.
Render Color (R G B) (rendercolor) <color255>
Color tint.
Disable Receiving Shadows (disablereceiveshadows) <boolean>
Prevent the entity from receiving shadows on itself.

RenderFXChoices:

Render FX (renderfx) <choices>
Preset pattern of appearance effects.
To do: 18-21, 25

Angles:

Pitch Yaw Roll (Y Z X) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

DXLevelChoice:

Minimum DX Level (mindxlevel)<choices>
Maximum DX Level (maxdxlevel)<choices>
The entity will not exist if the engine is running outside the given range of DirectX Versions. Only used by Orange Box and 2013 SDK games.
Warning: If these are used, the object may break when the user switches their DirectX settings.
  • Default (no bounding)
  • DX7
  • DX8
  • DX8.1
  • DX9 SM2
  • DX9 SM3

SystemLevelChoice:

Minimum CPU Level (mincpulevel) <choices> (New with Left 4 Dead)
A user with a CPU level lower than this will not see this object rendered in-game. It's unclear how the CPU level is decided, but most systems are classified as "high".
Maximum CPU Level (maxcpulevel) <choices> (New with Left 4 Dead)
  • 0: Default
  • 1: Low
  • 2: Medium
  • 3: High
Minimum GPU Level (mingpulevel) <choices> (New with Left 4 Dead)
Maximum GPU Level (maxgpulevel) <choices> (New with Left 4 Dead)
  • 0: Default
  • 1: Very low
  • 2: Low
  • 3: Medium
  • 4: High

Flags

  • 1 : Start On
  • 2 : No Dynamic Light

Inputs

LightOn
Turn the spotlight on.
LightOff
Turn the spotlight off.
SetColor  <color255>
Change the color of the spotlight. Light must be turned off then back on before changes take effect.
ForceUpdate  (New with Alien Swarm)
Force an update of the spotlight position and orientation.

Targetname:

Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although entities with a large number of children are killed marginally faster.
AddOutput  <string>
Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
Format: <key> <value>
Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
FireUser1 to FireUser4
Fire the OnUser outputs; see User Inputs and Outputs.
Use  !FGD
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.
RunScriptFile  <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.
RunScriptCode  <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 <Left 4 Dead 2>, 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.
CallScriptFunction  <string> (New with Left 4 Dead 2) !FGD
Execute a VScript function in the scope of the receiving entity.
Note:This input is missing from some games FGD files.
SetLocalOrigin  <origin> (New with Alien Swarm) !FGD
Set this entity's origin in the map.
Note:This input is missing from some games FGD files.
SetLocalAngles  <angles> (New with Alien Swarm) !FGD
Set this entity's angles in the map.
Note:This input is missing from some games FGD files.

Parentname:

SetParent  <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment  <string>
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.
SetParentAttachmentMaintainOffset  <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.

RenderFields:

Alpha  <integer>
Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its Render Mode (rendermode) set to a number other than 0.
Color  <color255>
Sets an RGB color for the entity.

Outputs

OnLightOn
Fires when light turns on.
OnLightOff
Fires when light turns off.

Targetname:

OnUser1 to OnUser4
These Outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.
OnKilled  (New with Left 4 Dead)
This Output fires when the entity is killed and removed from the game.

See also