This article relates to the game "Day of Defeat". Click here for more information.

env_model

From Valve Developer Community
Jump to navigation Jump to search

C++ Class hierarchy
CEnvModel
CBaseAnimating
CBaseDelay
CBaseEntity
C++ effects.cpp

env_model is a model entity available in Spirit of Half-Life Spirit of Half-Life, Day of Defeat Day of Defeat, Cry of Fear Cry of Fear, and Paranoia Paranoia.

It is used to place a model (usually an MDL) on a map, with optional animation and no collision. In the official FGD file it is descibed as a "new alternative to cyclers".

Icon-Important.pngImportant:Env_models do not have any collision, and will not cast shadows with normal compilers.
PlacementTip.pngWorkaround:A few options:
  • Create a brush-based collision mesh and tie it to a func_wall with rendermode set to 4 (aka solid), renderamt set to 0 (aka invisible), ZHLT light flags to "Opaque", and zhlt_striprad set to 1 (aka enabled). This will also cast lightmap shadows, unless alphatest ({) textures are used.
    Note.pngNote:Will use up an extra edict; use sparingly.
  • Use NULL brushes on a func_detail, and ensure the env_model's origin is not inside of the brushes.
  • Use clip brushes. Note that clip brushes can be shot through, so this should only be done for certain niche situations. Additionally, this method will not cast lightmap shadows.
    Note.pngNote:NULL and clip brushes will use the default footstep sounds when stepped on; the func_wall method should be used for non-concrete surfaces, such as tanks or sandbags.

Key Values

Name (targetname) <string>
The targetname that other entities refer to this entity by, usually via the target, killtarget, and TriggerTarget KVs.
Note.pngNote:In Day of Defeat Day of Defeat, unnamed env_models are loaded clientside, instead of by the server. This means they only count as an edict for a split second upon loading the map or restarting the round.
Pitch Yaw Roll (Y Z X) (angles) <QAngle>
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.
Model (model) <model path>
Model to display (MDL, BSP, or SPR). Relative to mod folder.
Colormap (colormap) <integer>
Works like the deathmatch recolor system, wherein this KV equals (bottomcolor * 256) + topcolor. This value can be calculated using Half-Life Asset Manager.
Skin (skin) <integer> (not in Day of Defeat)
Display different skins of the model if available.
Body (body) <integer>
Display different sub-models of the model if available.
Sequence when on (m_iszSequence_On) <string>
Displays the animation sequence of the model when on.
Behaviour when on (m_iAction_On) <choices>
Behaviour of the model when on.
Value Description
0 Freeze when sequence ends
1 Loop
2 Change state when sequence ends
Sequence when off (m_iszSequence_Off) <string>
Displays the animation sequence of the model when off.
Behaviour when off (m_iAction_Off) <choices>
Behaviour of the model when off.
Value Description
0 Freeze when sequence ends
1 Loop
2 Change state when sequence ends
Render Mode (rendermode) <choices>
Render Mode to use.
Render modes
  1. Normal
  2. Color
  3. Texture
  4. Glow
  5. Solid
  6. Additive
Render Amount (0-255) (renderamt) <integer>
Controls transparency when using another render mode then normal. 0 is completely invisible, and 255 is opaque. If render mode is solid, then all values except 0 are opaque.
Render Color (R G B) (rendercolor) <color255>
Color to use by the specified render mode.
Also used on brush entities to control the speed of scrolling textures; see func_conveyor for more information.
Render FX (renderfx) <choices>
Render FX mode to use, for special effects.
Render effects
  1. Normal
  2. Slow Pulse
  3. Fast Pulse
  4. Slow Wide Pulse
  5. Fast Wide Pulse
  6. Slow Fade Away
  7. Fast Fade Away
  8. Slow Become Solid
  9. Fast Become Solid
  10. Slow Strobe
  11. Fast Strobe
  12. Faster Strobe
  13. Slow Flicker
  14. Fast Flicker
  15. Constant Glow
  16. Distort
  17. Hologram (Distort + fade)


ZHLT:

Copy lighting from (VHLT+) (zhlt_copylight) <targetname>
Copies the lighting from the named entity to the nearest lightmap luxel below this entity's origin.
Tip.pngTip:To avoid having the copied lighting visibly affecting the brush lighting, put a 16x16x1 func_detail with zhlt_noclip enabled directly below this model's origin. Texture the top face with black_HIDDEN, and the rest of the faces with SKIP. If the player or any other MDL entity can go above this model, place another identical func_detail above this model's origin to reduce the chance of extraneous models being lit weirdly.
Note.pngNote:Not compatible with entities using the effect flag EF_INVLIGHT.
Model shadows (UMHLT, SDHLT) (zhlt_studioshadow) <boolean>
Enable to cast shadows from MDLs found in the model KV.
Model shadow mode (SDHLT) (zhlt_shadowmode) <choices>
0 - Use Bounding Box
1 - Use triangles (default)
2 - Use Bounding boxes of triangles


Flags

Initially Off : [1]
Drop to Floor : [2]

See also