4.1. mtl_env_model

Half-Life has a few entities for placing prop models, but all of them have drawbacks:

  • monster_generic and monster_furniture can't be placed close to walls, they'll drop to the floor, they bleed when shot and they block player movement.
  • cycler_sprite disappears after loading a savegame, and because it's a sprite entity selecting a model can be cumbersome.
  • env_sprite doesn't support body and skin selection, and sometimes suffers from an orientation bug. And as with cyler_sprite, selecting a model can be cumbersome.

Of all these, env_sprite appears to be the least troublesome, so that is what mtl_env_model uses. mtl_env_model solves the orientation and model-selection problems, so the only limitations are a lack of body and skin support.

Properties

  • Name (targetname) -- Giving this entity a name lets other entities trigger it, which will make the model invisible or visible again.
  • Render Mode (rendermode)
    • Normal (0) -- The model is rendered normally. FX Amount has no effect, the model is always fully opaque.
    • Color (1) -- The model is rendered normally, but FX Amount controls the overall transparency.
    • Texture (2) -- Same as 'Color' mode.
    • Glow (3) -- Same as 'Color' mode.
    • Solid (4) -- Same as 'Color' mode.
    • Additive (5) -- The model is rendered as an additive overlay, which makes whatever is behind the model appear more bright. Brighter parts will add more brightness, whereas black parts will add no brightness at all. FX Amount controls the 'strength' of the effect.
  • FX Amount (0 - 255) (renderamt) -- Controls the overall transparency of the model, with 0 being fully transparent, and 255 being fully opaque.
  • Pitch Yaw Roll (Y Z X) (angles) -- The model's orientation. 0 0 0 is facing eastward. Pitch makes the model look up (positive) or down (negative), yaw makes the model look to the left (positive) or to the right (negative), and roll makes the model lean to the right (positive) or to the left (negative).
  • Animation speed (framerate) -- Controls animation speed. At 1.0, the selected animation is played at its default speed. At 2.0, it's played twice as fast. The default is 1.0.
  • Model name (model) -- The relative path of the model (.mdl file).
  • Animation sequence (index) (sequence) -- The animation that will be played. Animations can only be selected by index, not by name. To find this index, open the model in Half-Life Asset Manager, go to the Sequences tab, select the desired sequence and look at the 'Sequence number.

Flags

  • Start invisible (when named) (1) -- If enabled, the model will initially be invisible, and will only become visible after being triggered.
  • Play once (2) -- If enabled, the model will become invisible after the selected animation has played once. The animation can still be played again by triggering the model.

Notes

  • Triggering this entity with an 'on' signal via a trigger_relay (or by using the +target pattern) will make it appear. An 'off' signal will make it disappear. Triggering it normally will toggle its visibility.
  • The env_sprite game-code contains an old Worldcraft-related hack that changes the angles if roll is 0. To avoid that issue, MESS uses a 'template behavior' to set the roll to 360 if it's 0, so you don't have to worry about that.