func_precipitation

From Valve Developer Community
Revision as of 21:02, 14 August 2014 by CK1 (talk | contribs) (Added large amount of documentation to console commands and cleaned up page)

Jump to: navigation, search

func_precipitation is a brush entity available in all Source games. It creates rain and snow inside its volume.

Rain Related Console Commands

There are a number of console commands that control func_precipitation rendering.

  • See also Precipitation issues - details various issues and workarounds involving the use of this entity.
Command Name Value Description
r_rainalpha <float> Adjusts transparency of rain particles.
r_rainProfile <bool> Displays stats on rain rendering costs.
r_RainHack <bool> Overrides density values set in Hammer. Enabling will result in longer and more dense rain than at 100%. Can help solve visibility issues.
Note:Rain may fall through brushes when this command is enabled.
r_rainspeed <float> Lower values will cause rain to disappear sooner and fall slower. Default value is 600.0f
r_RainSideVel <float> Controls sideways movement of the rain particles.
r_RainSimulate <bool> Toggles animation on the rain; freezes the rain when set to 0.
r_rainwidth <float> Widens the rain's alpha to desired value. Default value is 0.5
r_raindensity <float>
Bug: Appears to have no effect. Deprecated?
r_RainRadius <float>
Bug: Appears to have no effect. Deprecated?
r_rainalphapow <float>
Bug: Appears to have no effect. Deprecated?
r_rainlength <float> Changes the length of the rain particles. Default value is 0.1f
r_RainSplashPercentage <float> Percent chance of splash particles spawning when a particle is used.

To do: The names of these seem descriptive enough for most of them, but what does r_RainRadius, r_raindensity, and r_rainalphapow do?

Warning: Precipitation volumes shouldn't be placed in the same volume as func_smokevolume is. Otherwise engine may freeze at the end of loading the level. It is probably caused by some particle coding that do not accept this two types of sprites to render at once (in the same volume).


Keyvalues

Density (0-100%) <integer>
This is the amount of particles that fall down from top side of brush. However distance from first particle to second depends on a brush volume size!
Color (R G B) <color255>
Color added to sprites which are rendered transparently (probably rain and snow particles)
Precipitation Type <choices>
Precipitation type
Value Description
0 Rain
1 Snow (Identical to "Rain" - use "Snowfall" instead.)
2 Ash
Note:This option has problems in Counter Strike: Source and Half-Life 2 non-episodic (missing texture/sprite), can be fixed by extracting materials/effects/fleck_ash1 to 3 VMTs and VTFs, and ember_swirling001.vtf from episode 1 shared.gcf
3 Snowfall
4 Particle Rain (New with Left 4 Dead)
5 Particle Ash (New with Left 4 Dead)
6 Particle Rain Storm (New with Left 4 Dead 2)
7 Particle Bugs (New with Left 4 Dead 2)
8 Particle Smoke (New with Left 4 Dead 2)

Targetname:

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

Parentname:

Parent (parentname) <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.

Inputs

Targetname:

Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster than Kill.
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.
SetLocalOrigin <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.
SetLocalAngles <angles> (New with Alien Swarm) !FGD
Set this entity's angles.

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.

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  (Only in the Left 4 Dead series)
This Output fires when the entity is killed and removed from the game.