Trains | Index



func_train_ext
func_train_ext can have certain "children" objects that tag along, can change direction, or stop/resume at any time. These use "smart" waypoints and trigger relays that actually control most aspects of the train, but a simple train can still be setup by ignoring extra options. The last waypoint does not need a target. The train will either auto-reverse (if set) or wait for manual reverse/move triggers.

Key Value Pairs:
speed Speed of the train (can be overridden by waypoints)
dmg amonut of damage to inflict when blocked
noise Start/travel noise (can be overridden by waypoints)
noise1 Stop noise (can be overridden by waypoints)
noise4 Noise to make when changing directions (DON'T USE A LOOPED WAV!!)
noise5 Noise to make when trying to go wrong way at end of path (uses "noise1" if not set)
target First waypoint or start position
event Start at this waypoint (since you MUST use the first waypoint as the "target" on a non-looped path)
targetname Can be triggered and/or targeted by child objects

Spawnflags:
1 : START_ON Start the train immediately, even if targeted
2 : ALLOWPAUSE Re-Triggering will pause/resume the train at any point along it's path
4 : ALLOWCHANGEDIR Lets a changedir trigger reverse the train's direction at any time
8 : AUTOREVERSE Train automatically reverses direction when it hits the last/first waypoint (only makes sense if last waypoint has no target). It will NOT auto-reverse on spawn if facing the wrong way (which is possible and valid).
16 : BLOCKREVERSE Reverses train direction when blocked (after inflicting damage) Don't use this on trains with non-looped paths without some way of getting it back to the forward direction (AUTOREVERSE or ALLOWCHANGEDIR). Else it'll get stuck when it reaches the start point again.
32 : STARTREVERSE Start in reverse

Notes:
A train without a targetname will start immediately (doesn't need "START_ON" to be set) but it can not be stopped, and can not have children objects.
If your waypoints are not looped (i.e. the last point doesn't target the first), the train MUST target the first waypoint. Use the "event" target to have the train spanw at a different point along it's path ("event" is ignored if it's not on the same path.).
If you have a train on a non looped waypoint path, and AUTOREVERSE is not set, the train will stop at the last waypoint. If ALLOWCHANGEDIR is set, and the train gets a t_changerdir trigger, you will then be able to re-trigger movement in the reverse direction. Otherwise re-triggering will just produce the wrong-way sound.



train_ext_waypoint
func_train_ext is "dumb" on it's own these entities really control the train. These are used by func_watertrain as well.

Key Value Pairs:
speed Forward speed from this waypoint to the next (-1 is warp to next waypoint)
wait Time to pause at this waypoint when moving forward (-1 is wait for re-trigger, 0 is no pause)
noise Override train's start/travel noise from this waypoint to the next when moving forward
noise1 Override train's stop noise at this waypoint when moving forward (or between this waypoint and the next)
event Targetname of entity to fire when the train hits this point when moving forward
speed2 Reverse speed from this waypoint to the previous in (-1 is warp to previous)
wait2 Time to pause at this waypoint when moving in reverse (-1 is wait for re-trigger, 0 is no pause)
noise2 Override train's start/travel noise from this waypoint to the previous when moving in reversw
noise3 Override train's stop noise at this waypoint when moving in reverse (or between this waypoint to the previous)
event2 Targetname of entity to fire when the train hits this point when moving in reverse
targetname This waypoint's name
target Name of the next waypoint

Notes:
Always use unique sets of train_ext_waypoint for func_train_ext and func_watertrain. The waypoints are linked with one another and can only work with one train at a time.
Speed propogates from waypoint to waypoint (if it's not set, the last speed is used). The first waypoint can also simply use the train's "speed" if set.
If the reverse speed/event are not set, the forward direction speed/event are used. Reverse sounds default to the train's sounds if they are not set. (This only matters for trains that can go in reverse of course).