Classnames: | func_train func_train_mp (PoP) |
Purpose: | Enjoy the ride. |
H2 Code: | plats.hc |
fields required: | target |
Trains are moving platforms that players can ride on. To make a simple
train, you need a func_train entity that
owns the brushes constituting the platform, boat or whatever, and two
or more path_corner
entities for the train to shuttle back and forth between. The
train targets the path_corner
where it's going to start, this path_corner targets the one
where it goes next, and so on, till the sequence of path_corner
entities closes in a loop. If one of the path_corners doesn't
have a valid target field (targetting another path_corner),
the game will crash or exhibit other undesired behavior. The fields of a func_train and its associated path_corners control its behavior in a somewhat complicated way, so here is a list of types of effects and relevant fields:
Finally, func_trains have an odd relationship to the somewhat enhanced trains found in the Mission Pack: for the MP there is an additional classname, func_train_mp, but the classname seems to in fact be interchangeable with func_train. The difference in behavior is produced by the fact that if a func_train or func_train_mp entity is spawned in a map whose worldspawn entity has a spawnflag-value of 1, then it is a Mission Pack train, and if it is spawned in a map whose worldspawn entity does not have this spawnflag set, it spawns as an ordinary train (but only the PoP progs.dat will recognize the func_train_mp classname). Don't ask me why it was done this way. Anyway I've set up a separate page for the Mission Pack func_train_mp entity, but only the changed/additional behavior is discussed there. |
target | Value is a name, targetting the path_corner that the train starts out at. (REQUIRED; this path_corner then targets the next, and so on). The `minimum point' of the func_train will be located at the origin (map position) of the path_corner, this is the lower south-east corner of the smallest box containing the train's brushes. |
targetname | Value is a name, train starts and stops when triggered. If there is no targetname, the train runs continuously from when spawned. If the train is running, and is triggered, it stops when it reaches the next path_corner. But if the TOGGLE spawnflag is set, it will automatically stop at each path_corner, and will need to be retriggered in order to procede. |
wait | Value is a number, time train waits at a path_corner. If the path_corner has a wait value, this overrides the one on the train, and can stop the train or explode it. |
speed | Value is a number, train's speed of movement, default = 100. If the train arrives at a path_corner with a different speed-value, this overwrites the original if the path_corner has an angles-value. Otherwise this won't work. |
pausetime | Value is a number, time until train explodes after arriving at a path-corner with wait-value of -2. |
dmg | Value is a number, damage train does when blocked, default=2. |
anglespeed | Value is a number, supposedly speed of rotation at turns. It does appear in one of the maps, but actually doesn't seem to do anything on a train (but is functional on a path_corner). |
soundtype | Value is a number, indicating sound train makes:
|
thingtype | Value is a number, determing chunkstyle if train explodes
(not default health or impact soumd trains seem to be indestructible
other than by the -2 wait-value
on a path_corner.
Some basic thingtypes are:
|
abslight | Value is a decimal number between 0 and 1, determines absolute brightness of train (default = 0). |
spawnflags |
|
Name: func_train Description: Moving and rotating train. Moves along path_corner entities Can move and rotate along any combination of axes simultaneously. Can also be made to be translucent or explode when it reaches a path_corner. Somewhat limited when triggered Bounding box size: none, solid entity Keys/Attributes: origin: XYZ coordinate used to specify center of rotation speed: 100 (default) speed of displacement. The next path_corner's speed value will override this if it's not the same. anglespeed: 100 (default) speed of rotation. The next path_corner's anglespeed value will override this if it's not the same. The train's rotation angles are set by the individual path_corners pausetime: this the amount of time the train will wait before exploding if the path_corner's wait value is set to -2. Has no effect otherwise dmg: damage to inflict when blocked (2 default). soundtype: 0) no sound 1) ratchet metal target: points to the first path_corner. The train will spawn at it's location. This must be used otherwise the train cannot spawn at all. targetname: use when train is to be actuated by a trigger. Can also be used to make the last path_corner to point to it if you want the train to return to its starting point thingtype: this determines the appearance of the chunks and the sound that is produced when the train explodes (wait must be set at -2). Independent of brush texture. 1 : "grey stone (default)" 2 : "wood" 3 : "metal" 4 : "flesh" 5 : "soft stone" 6 : "clay" 7 : "green leaves" 8 : "hay" 9 : "brown stone" 10 : "red cloth" 11 : "wood & green leaves" 12 : "wood & metal" 13 : "wood & gray stone" 14 : "metal & gray stone" 15 : "metal & red cloth" 16 : "spider web" 17 : "glass" 18 : "ice" 19 : "clear glass" 20 : "red glass" abslight: can make it internally illuminated even in total darkness Values are 0-1: 0 is unlighted, 1 is equivalent to 300 (value is a percentage of 300) 0 (default) Spawnflags: 1 = GLOW: turns the train into a light globe sprite and lights up the spawn area. 2 = TOGGLE: set this to be able to restart a triggered train once it stops on path_corner with wait set to -1. This will only work for the first path_corner set to this value. Once it reaches the next one, the train will stop but can't be restarted unless the next one is the spawn path_corner 4 = RETURN: this doesn't seem to have any effect on the train 8 = TRANSLUCENT: makes the train translucent. Notes: trains must have at least 1 path_corner in order to spawn in the game at all and at least 2 to function as moving train. If one of the paths don't have a valid target, the game will report an error and the map won't load (loop that loop). The train will spawn at the first path_corner's location. Also, never use a wait value of -1 on the spawn path_corner otherwise the train will never move even if it's triggered. The train's sound only goes "ka-klunk" and stops on paths with a wait value > 0 , it doesn't stop on paths with wait set to -1. The only way around this for a triggered train is to set the soundtype to 0: no sound. The train will modify it's angles by whatever angles it's next path point has, so if it heads towards a path corner with an angle of '0 90 0', the train will rotate '0 90 0' along the Z axis on it's way to the pathpoint. If you make the anglespeed the same as the angle, the turn should finish right as the train gets to the new spot. A path_corner using spawnflag "SYNCH" will make the train automatically calculate a new anglespeed based on the distance it's going and will finish the turn at the same time the move is done.