Effect flags: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(available on the server.)
 
(36 intermediate revisions by 12 users not shown)
Line 1: Line 1:
For configuring client-side visual effects.
{{LanguageBar}}
{{TabsBar|main=gs|base=Effect flags}}
A set of [[Flags|bitflags]] for configuring client-side visual effects.


== Usage from Hammer ==
== Usage From Hammer ==
Effect flags can be configured from Hammer. To do so, turn off [[SmartEdit]] and add a new keyvalue pair:


Effect flags can be configured from Hammer. To do so turn off [[SmartEdit]] and add a new keyvalue pair:
effects <n>


effects <n>
"<code style=padding:0>n</code>" is the sum total of the flags you want to use. For example, 66 would mean <code>EF_BRIGHTLIGHT</code> and <code style=padding:0>EF_NORECEIVESHADOW</code>.


'<code>n</code>' is the sum total of the flags you want to use. For example, 66 would mean <code>EF_BRIGHTLIGHT</code> and <code>EF_NORECEIVESHADOW</code>.
Alternatively, you can add the following code (or similar) to the [[FGD]] entries of entities you wish to use effect flags on:
effects(choices) : "Effect Flags" : 0 : "For configuring visual effects. If you want to combine effects, simply type in the sum of the effect numbers, e.g., '72' for 64+8." =
[
0: "0 - None"
1: "1 - EF_BONEMERGE: Bonemerge always (very expensive!)"
2: "2 - EF_BRIGHTLIGHT: Bright, dynamic light at entity origin"
4: "4 - EF_DIMLIGHT: Dim, dynamic light at entity origin"
8: "8 - EF_NOINTERP: No movement interpolation"
16: "16 - EF_NOSHADOW: Don't cast shadows"
32: "32 - EF_NODRAW: Don't draw entity (entity is fully ignored by clients, NOT server; can cause collision problems)"
64: "64 - EF_NORECEIVESHADOW: Don't receive dynamic shadows"
128: "128 - EF_BONEMERGE_FASTCULL: Bonemerge only in PVS, better performance but prone to disappearing. Use with Bonemerge."
256: "256 - EF_ITEM_BLINK: Unsubtle blink"
512: "512 - EF_PARENT_ANIMATES: Flag parent as always animating and realign each frame"
]
If you wish to use effect flags on enough entity classes, it may be worthwhile to create or modify a <code>BaseClass</code> instead of adding code to numerous entity classes individually.
{{tip|Effect flags are enabled by default in {{teamSpen|4}}.}}


== Flags ==
== Flags ==
{{fl|1|[[EF_BONEMERGE]]|Merges bones of names shared with a parent entity to the position and direction of the parent's.}}
{{fl|2|[[EF_BRIGHTLIGHT]]|Emits a dynamic light of RGB(250,250,250) and a random radius of 400 to 431 from the origin.}}
{{fl|4|[[EF_DIMLIGHT]]|Emits a dynamic light of RGB(100,100,100) and a random radius of 200 to 231 from the origin.
{{bug|hidetested=1|In {{bms|4}}, the dynamic light from both [[EF_BRIGHTLIGHT]] and [[EF_DIMLIGHT]] appears every frame, but not removed if the game is paused. This means that in pause mode, a huge number of lights will appear and reduce performance, then they will crash the game. Safe to use only in multiplayer mode.}}
}}


;1 - <code>EF_BONEMERGE</code>
{{fl|8|[[EF_NOINTERP]]|Don't [[interpolation|interpolate]] on the next frame.{{bug|hidetested=1|Causes crashes.}}}}
:Merges bones of names shared with a parent entity to the position and direction of the parent's.
{{fl|16|[[EF_NOSHADOW]]|Don't create a render-to-texture shadow, does not affect projected texture shadows.{{note|This flag is applied when setting <code style{{=}}padding:0>disableshadows 1</code>.}}}}
;2 - <code>EF_BRIGHTLIGHT</code>
{{fl|32|[[EF_NODRAW]]|Entity is completely ignored by the client, and stops drawing the entity.
:Emits a dynamic light of RGB(250,250,250) and a random radius of 400 to 431 from the origin.
{{Important|Can cause prediction errors if a player proceeds to collide with it on the server, so use {{ent|Render Modes|alt=rendermode|10}} instead if this is a problem.}} }}
;4 - <code>EF_DIMLIGHT</code>
{{fl|64|[[EF_NORECEIVESHADOW]]|Don't receive dynamic shadows.{{note|1=This flag is applied when setting <code style=padding:0>disablereceiveshadows 1</code>.}}}}
:Emits a dynamic light of RGB(100,100,100) and a random radius of 200 to 231 from the origin.
{{fl|128|[[EF_BONEMERGE_FASTCULL]]|For use with <code style=padding:0>EF_BONEMERGE</code>. If set, the entity will use its parent's origin to calculate whether it is visible; if not set, it will set up parent's bones every frame even if the parent is not in the [[PVS]].}}
;8 - <code>EF_NOINTERP</code>
{{fl|256|[[EF_ITEM_BLINK]]|Blink an item so that the user notices it. Added for original Xbox, and not very subtle.}}
:Don't [[interpolate]] on the next frame.
{{fl|512|[[EF_PARENT_ANIMATES]]|Assume that the [[parent]] entity is always animating. Causes it to realign every frame.{{Note|Does not function with the <code>effects</code> keyvalue.}}}}
;16 - <code>EF_NOSHADOW</code>
{{fl|1024|[[EF_MARKED_FOR_FAST_REFLECTION]]|Marks the entity to render in fast water reflections.{{note|This flag is applied when setting <code style{{=}}padding:0>drawinfastreflection 1.</code>}}|since={{portal2}}}}
:Don't cast a shadow. {{TODO|Does this also apply to shadow maps?}}
{{fl|2048|[[EF_NOSHADOWDEPTH]]|Stops {{ent|env_cascade_light}} and {{ent|env_projectedtexture}} from making shadows for this entity.{{note|This flag is applied when setting <code style{{=}}padding:0>disableshadowdepth 1</code>.}}|since={{portal2}}}}
;32 - <code>EF_NODRAW</code>
{{fl|4096|[[EF_SHADOWDEPTH_NOCACHE]]|Don't cache this entity into shadow depthmaps, update it every frame.}}
:Entity is completely ignored by the client. Can cause prediction errors if a player proceeds to collide with it on the server.
{{fl|8192|[[EF_NOFLASHLIGHT]]|Stops projected textures from making shadows for this entity.{{note|This flag is applied when setting <code style{{=}}padding:0>disableflashlight 1</code>.}}|since={{portal2}}}}
;64 - <code>EF_NORECEIVESHADOW </code>
{{fl|16384|[[EF_NOCSM]]|Don't cast shadows from cascade shadow maps.|since={{csgo}}}}
:Don't receive dynamic shadows.
;128 - <code>EF_BONEMERGE_FASTCULL</code>
:For use with <code>EF_BONEMERGE</code>. If set, the entity will use its parent's origin to calculate whether it is visible; if not set, it will set up parent's bones every frame even if the parent is not in the [[PVS]].
;256 - <code>EF_ITEM_BLINK</code>
:Blink an item so that the user notices it. Added for Xbox 1, and really not very subtle.
;512 - <code>EF_PARENT_ANIMATES</code>
:Assume that the [[parent]] entity is always animating. Causes it to realign every frame.


== Functions ==
== Functions ==
{{warning|Make sure not to confuse <code>EF_</code> effect flags with <code>EFL_</code> entity flags (aka <code>EFlags</code>). Always use the following <code>AddEffects</code> series of functions for the <code>EF_</code> flags on this page, and never <code>AddEFlags</code>. Even some of Valve's own code and past versions of this article have made this mistake!}}
*<code>AddEffects()</code> / <code>SetEffects()</code>
*<code>RemoveEffects()</code>
*<code>GetEffects()</code>
*<code>IsEffectActive()</code>


*<code>AddEFlags()</code> / <code>SetEFlags()</code>
== See also ==
*<code>RemoveEFlags()</code>
* <code style=padding:0>[http://wiki.sourcepython.com/_modules/entities/constants.html entities.constants]</code>
*<code>GetEFlags()</code>
* [[Non-FGD features]]
*<code>IsEFlagSet()</code>
* [[Render Modes]]


[[Category:Flags]]
[[Category:Flags]]

Latest revision as of 04:39, 17 July 2025

English (en)Translate (Translate)

A set of bitflags for configuring client-side visual effects.

Usage From Hammer

Effect flags can be configured from Hammer. To do so, turn off SmartEdit and add a new keyvalue pair:

effects <n>

"n" is the sum total of the flags you want to use. For example, 66 would mean EF_BRIGHTLIGHT and EF_NORECEIVESHADOW.

Alternatively, you can add the following code (or similar) to the FGD entries of entities you wish to use effect flags on:

effects(choices) : "Effect Flags" : 0 : "For configuring visual effects. If you want to combine effects, simply type in the sum of the effect numbers, e.g., '72' for 64+8." =
[
	0: "0 - None"
	1: "1 - EF_BONEMERGE: Bonemerge always (very expensive!)"
	2: "2 - EF_BRIGHTLIGHT: Bright, dynamic light at entity origin"
	4: "4 - EF_DIMLIGHT: Dim, dynamic light at entity origin"
	8: "8 - EF_NOINTERP: No movement interpolation"
	16: "16 - EF_NOSHADOW: Don't cast shadows"
	32: "32 - EF_NODRAW: Don't draw entity (entity is fully ignored by clients, NOT server; can cause collision problems)"
	64: "64 - EF_NORECEIVESHADOW: Don't receive dynamic shadows"
	128: "128 - EF_BONEMERGE_FASTCULL: Bonemerge only in PVS, better performance but prone to disappearing. Use with Bonemerge."
	256: "256 - EF_ITEM_BLINK: Unsubtle blink"
	512: "512 - EF_PARENT_ANIMATES: Flag parent as always animating and realign each frame"
]

If you wish to use effect flags on enough entity classes, it may be worthwhile to create or modify a BaseClass instead of adding code to numerous entity classes individually.

Tip.pngTip:Effect flags are enabled by default in TeamSpen's Hammer Addons TeamSpen's Hammer Addons.

Flags

EF_BONEMERGE : [1]
Merges bones of names shared with a parent entity to the position and direction of the parent's.
EF_BRIGHTLIGHT : [2]
Emits a dynamic light of RGB(250,250,250) and a random radius of 400 to 431 from the origin.
EF_DIMLIGHT : [4]
Emits a dynamic light of RGB(100,100,100) and a random radius of 200 to 231 from the origin.
Icon-Bug.pngBug:In Black Mesa Black Mesa, the dynamic light from both EF_BRIGHTLIGHT and EF_DIMLIGHT appears every frame, but not removed if the game is paused. This means that in pause mode, a huge number of lights will appear and reduce performance, then they will crash the game. Safe to use only in multiplayer mode.


EF_NOINTERP : [8]
Don't interpolate on the next frame.
Icon-Bug.pngBug:Causes crashes.
EF_NOSHADOW : [16]
Don't create a render-to-texture shadow, does not affect projected texture shadows.
Note.pngNote:This flag is applied when setting disableshadows 1.
EF_NODRAW : [32]
Entity is completely ignored by the client, and stops drawing the entity.
Icon-Important.pngImportant:Can cause prediction errors if a player proceeds to collide with it on the server, so use rendermode 10 instead if this is a problem.
EF_NORECEIVESHADOW : [64]
Don't receive dynamic shadows.
Note.pngNote:This flag is applied when setting disablereceiveshadows 1.
EF_BONEMERGE_FASTCULL : [128]
EF_ITEM_BLINK : [256]
Blink an item so that the user notices it. Added for original Xbox, and not very subtle.
EF_PARENT_ANIMATES : [512]
Assume that the parent entity is always animating. Causes it to realign every frame.
Note.pngNote:Does not function with the effects keyvalue.
EF_MARKED_FOR_FAST_REFLECTION : [1024] (in all games since Portal 2)
Marks the entity to render in fast water reflections.
Note.pngNote:This flag is applied when setting drawinfastreflection 1.
EF_NOSHADOWDEPTH : [2048] (in all games since Portal 2)
Stops env_cascade_light and env_projectedtexture from making shadows for this entity.
Note.pngNote:This flag is applied when setting disableshadowdepth 1.
EF_SHADOWDEPTH_NOCACHE : [4096]
Don't cache this entity into shadow depthmaps, update it every frame.
EF_NOFLASHLIGHT : [8192] (in all games since Portal 2)
Stops projected textures from making shadows for this entity.
Note.pngNote:This flag is applied when setting disableflashlight 1.
EF_NOCSM : [16384] (in all games since Counter-Strike: Global Offensive)
Don't cast shadows from cascade shadow maps.

Functions

Warning.pngWarning:Make sure not to confuse EF_ effect flags with EFL_ entity flags (aka EFlags). Always use the following AddEffects series of functions for the EF_ flags on this page, and never AddEFlags. Even some of Valve's own code and past versions of this article have made this mistake!
  • AddEffects() / SetEffects()
  • RemoveEffects()
  • GetEffects()
  • IsEffectActive()

See also