Tutorials‎ > ‎

Controllable Vehicle/Train


Make a train, car, boat, elevator, chopper, ship, plane or even roller-coaster with powerful func_tracktrain entity.

1. Make sure you have created room with light and info_player_start.

2. Set up the map for your train. Train brush will move along path_track's.


Controllable Vehicle


1. 
Turn the brush you want to have controllable movement (be vehicle) into func_tracktrain. This entity must have included "ORIGIN" brush. The position in the editor of func_tracktrain does not matter. Train spawns at the first path_track. It is REQUIRED to make func_train face WEST (face left in tor top view of editor). On map start the train will automatically rotate to face next path_track.

2. The train is not yet controllable. Place the func_traincontrols brush entity covered with "AAATRIGGER" texture, set it's train name to func_tracktrain name. This brush generates
the place where player must stand to control the vehicle. It will move with
func_tracktrain automatically. Bottom of trigger should touch the vehicle floor. Putting any other brushes into this trigger's bottom will 
make func_traincontrols unusable. The height of the brush shouldn't be too low.

3. The movement of the func_train is pretty simple. You don't need to set any pitch/yaw/roll. The trains automatically facing next path_track.

4. Now let's set keyvalues:

speed --> determines how fast our train moves (units per seconds).
initial speed --> starting speed of train on map load.
sound --> the sounds scheme for this train. Included move, start, stop.
first stop target --> the first path_track name where you want your train starts at. We'll set
it up later.

damage on crush --> damage deal to entity that attempts to block train.
volume --> volume of train sounds.
bank angle on turns--> the bank angle of train when it's turning.
height above track--> Important. Basically train spawn sewed into the ground. That's because the center of the func_tracktrain is always dropped to path_track center. Set this to positive value to prevent that. E.g. when the func_tracktrain's origin height amount is 56, set the height above track to 28. The train now have it's origin center 28 units above path_track.
distance between the wheels--> Distance between the virtual train wheels. 
Set to higher values for smoother train turning.

5. Go into "flags" tab:

no pitch (x-rot) --> disables train rotation when moving uphill/downhill.
no user control --> train can't be controlled by player (only triggers).
forward only --> train can move only forward.
passable --> can be passed through.
no yaw (y-rot) --> disables standard left/right rotation.

6. Place path_tracks entities at the map. Form a full func_tracktrain route
by connecting first 
path_track to the second one, and the 
second path_track 
to the third e.t.c.

You can loop the train path by connecting last path_track with the first one. Pitch/Yaw/Roll is obsolete.

    


             


Once again, You must place the train to face LEFT in the top view of the editor, 
no matter in which direction it will move in game. It will be automatically reorient to face second path track (the target of the starting path_track).

7. You can set up some Path_tracks keyvalues if needed:

fire on pass --> when train reaches this point, it will trigger an entity with it's name specified here.
branch path --> used for changing next target.
fire on dead end --> triggers, if this point is a dead end of the path.
new train speed --> overrides train speed when reaching this point.

8. And here you can change select flags if needed:

disabled --> start disabled, trigger path to enable it.
fire once --> triggers target only once.
branch reserve --> swap the branch path and next target on start.
disable train --> disables the train controlling, so you can't control train any further. This option won't prevent train from moving.



Dynamic Dead End

Basically dead end is a last path_track that have next target not specified.

1. To make a dead end, just trigger a path_track with empty branch path keyvalue. Can be triggered again to make it active again.

2. To make a dead end on map start, just select disabled flag in path_track, then trigger it to open a path.



Change The Train Path


1.
 Create the regular train path, and train.

2. Put a new path_tracks in the place where you want new path for the train. Connect it as normal. Name the first path_track of a new path.

3. Go to properties of path_track that will be connected to the new path. Set branch path to name of the first path_track 
in a new path.

4. Triggering the path_track with branch path will toggle between next stop target and branch path path_track.


Comments