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
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 usemodel
instead you'd have to be careful to create the sprite/model entity first.angles
(Roll) is used to initially offset the sprite's rotation. So to animate the rotation you use the third value ofavelocity
(Z).