train_setspeed

XashXT

train_setspeed

Changes the speed and direction of a func_tracktrain dynamically.

Spawnflags

SF_ACTIVATE_TRAIN 1 (activate the func_tracktrain on start)
SF_TRAINSPEED_DEBUG 2 (output debugging information about train starts and stops, and its current speed)

Options

time How many seconds it takes the train to reach the set speed.
mode How the speed setting is applied:
  • 0—instantly
  • 1—over the specified time interval
train Name of the train that the new speed is applied to.
speed New speed.

Usage Details

  • The primary purpose of this entity is to slow down a train that approaches a station and speed up a train that departs; using specially placed path_track entities with fine-tuned speed settings is clunky. However, you can use the object to better control trains in other ways, because it lets you activate a train, stop it and change its direction.