env_screenoverlay

From Valve Developer Community
Jump to: navigation, search
env_screenoverlay in practice with effects/combine_binocoverlay. The following links to a youtube video of these in effect

env_screenoverlay is a point entity available in all Source games. It can display and control a set of screen overlays, to be displayed over the player's view. Useful for view effects like drunkenness, or teleporter afterimages, etc.

Note:An overlay will be applied to all players in multiplayer games, even when the !activator is a player. To apply an overlay to a single client, the command r_screenoverlay <material_path> (requires sv_cheats) needs to be used with a point_clientcommand.
Note:In <Counter-Strike: Global Offensive>, when hosting on a dedicated server, point_clientcommand can be used to set r_screenoverlay on individual players with sv_cheats 0.
Note:In [Portal 2], screen overlays are disabled by default. You must set cvar r_drawscreenoverlay to 1 to enable.

Materials

You can use any material as an overlay, but UnlitGeneric ones are recommended to avoid artefacting.

Valve provide these materials in the /effects folder:

combine_binocoverlay
Combine binoculars
tp_eyefx/tpeye
Green teleport shimmer
tp_eyefx/tpeye2

Red teleport shimmer

tp_eyefx/tpeye3
Blue teleport shimmer
tp_eyefx/tp_eyefx
Drugged distortion
tp_eyefx/tp_black
Black. A probable bug makes it so that a thin border around the overlay is still visible.
tp_eyefx/tp_eyefx_eli
Flashing animation of three figures. Hardly usable as an overlay.

These materials are not designed as screen overlays, but will work as one:

debug/yuv
Monochrome (Black and white)
effects/com_shield002a.vmt
The combine shield shader effect - refraction with drifting squares.
models/effects/portalfunnel_sheet
Red-yellow-green scrolling ground overlay
models/props_combine/portalball001_sheet
Green downward haze
effects/tp_refract
Red/Orange Refractive overlay
glass/glasswindow_refract01
As if looking through a glass Observation window from Portal

Keyvalues

Overlay Name 1 to Overlay Name 10 <string>
Name of the first overlay material to display.
Overlay Duration 1 to Overlay Duration 10 <float>
Amount of time that the overlay should be displayed for, after which it will begin showing the next overlay. Setting this to -1 will make the entity display the overlay indefinitely, until it's forced to change by an input.

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.

Flags

  • 1 : Allow Suit Zoom

Inputs

StartOverlays
Start displaying the first overlay.
StopOverlays
Stop displaying any overlays.
SwitchOverlay  <float>
Switch to displaying a specific overlay. Pass in the desired overlay number in the parameter. Entering -1 as the value will cause the overlay to display indefinitely.

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.

Outputs

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