|
|
|
| |||||||||||||||||||
Alternate paths
When using func_tracktrain on path_tracks it’s often handy to have an alternative path.
Imagine a train that is on a track, the player has to stop the train and push a button, then once back on the train it follows another set of tracks. In this project I’ve used a Roller_Spikes.mdl parented to a func_tracktrain. The Roller will follow a triangular path on the left side of the screen for 3 loops. It will then switch to a triangle on the right side for three loops. This will continue indefinitely. This is down with 5 path_track entities with one of them acting as a track switch. I’m using a math_counter to change the track but the very same effect can be achieved with triggers, buttons, etc. Note: Please refer to my series of tutorials on HL2 Trains for specific information about properties for tracks and trains. I’ve given each of the path_track entities a name that reflects their roll. This helps as you are working on your map. The two path_tracks on the left are named path_a1 and path_a2. The two path_tracks on the right are named path_b1 and path_b2. And the path_track in the center is named switch01.
The path_track switch01 is shared to create two triangular paths for the train. Note: Your paths do not need to be triangular; they can be whatever you desire. When the map loads the train will be moving from the start. Each time it passes switch01 I’m adding a value to a math_counter. When the math_counter gets to 3 it will switch the track. These are the properties. Class: math_counter Name: math01 Initial value: 0 Min legal value: 0 Max legal value: 3 Outputs: OnHitMax, switch01, ToggleAlternatePath OnHitMax, math01, Subtract, 3, 0.50 Class: path_track Name: switch01 Next stop target: path_a1 Branch Path: path_b1 Output: OnPass, math01, Add, 1 As you can see when the train gets to path_track switch01 an output will add the value 1 to the math_counter. When the math_counter gets to 3 it will fire an Output to ToggleAlternatePath which will instantly change the train to the alternate path. In this project I’ve added the Roller and a few sounds just for effect.
|