Vanilla sprite train

Half-Life HL
Vanilla sprite train by Admer456
Posted 3 years ago2020-11-23 20:42:35 UTC • Examples • Half-Life
Loading...
Screenshot Thumbnail
Name
Vanilla sprite train
By
Admer456 Admer456
Type
Map
Engine
Goldsource
Game
Half-Life
Category
Examples
Included
RMF/VMF
Created
3 years ago2020-11-23 20:42:35 UTC
Updated
3 years ago2020-11-23 20:58:04 UTC
Views
2651
Downloads
493
Comments
4

This example demonstrates how to achieve sprite trains in vanilla Half-Life. That's right, folks, no SoHL needed!

How to make

1. Place an env_sprite, with the "Start on" and "Only once" flags enabled
2. Place a func_train, with the "Not solid" flag enabled
3. Give the env_sprite a unique name (e.g. bobby)
4. Add a zhlt_usemodel keyvalue to the train, and in the value field, type in the sprite's entity name (e.g. bobby)

Notes

  • The func_train MUST have the "Not solid" flag checked, or else the engine will crash when the train is inside your FOV
  • If you want to control properties like render mode, render amount etc., do it on the func_train
  • An env_sprite is absolutely required in the map, so the game can precache the sprite model. Without precaching it, it won't work and the game will crash
  • This can also be used for studio models (.mdl files)
  • Animated sprites won't work
  • Triggering the train won't turn off the sprite (this is a func_train after all), use env_render for that
  • Untested, but avelocity should work
  • Untested, but special sprite orientations (VP_ORIENTED etc.) should also work

4 Comments

Commented 3 years ago2020-11-25 07:09:05 UTC Comment #103088
This is much better than having to turn a point entity to func_train only to see it's deleted by VHE in next launch!
Commented 3 years ago2020-11-26 21:40:26 UTC Comment #103092
Nice! I noticed that zhlt_usemodel also ensures that the 'template' entity whose sprite or model is used will be put before the entities that use it, so the map won't crash because the sprite or model hasn't been loaded yet. If you use model instead you'd have to be careful to create the sprite/model entity first.
Commented 9 months ago2024-01-21 17:24:15 UTC Comment #105910
angular velocity works, but it seems that model can only rotate around itself, not revolve around origin that is, for example, set far from train's center
Commented 3 months ago2024-08-07 07:30:02 UTC Comment #106282
To clarify angular velocity for sprites, the XYZ values of avelocity is treated as the angle's PYR to rotate for. Assuming parallel sprite (always facing the camera), the third value of angles (Roll) is used to initially offset the sprite's rotation. So to animate the rotation you use the third value of avelocity (Z).

You must log in to post a comment. You can login or register a new account.