Navigate InfoSuite
Hosted At
Link to Duke4
Advanced FX - Horizontally Moving Sectors - B2 : Two-Way Train

Two-Way Train

The Two-Way Train travels between point A and point B when activated by a trigger.

Create a long track sector, and place one room at each end. Separate the rooms from the track with Ceiling Doors ([0,20]). Place an L+[0,1] at one end of the track (point A), and an L+[0,0] at the other end of the track (point B). Place the player start position in the room near point A. Create the train sector within the track close to point B, and tag it [0,31]. Raise or lower the train's floor/ceiling to the desired height. Use the R key on the floor or ceiling if you want them to move with the train.


Place three Switches in the map (one in each room, and one on the train). If you create a nested sector within the train to place a Switch on, make sure the nested sector is tagged [0,31]. Tag all of the Switches [ActivationSound,Channel]. Place the following sprites within the train's bounding sector: S[Channel+1,30], A[0,Channel]. Move the S to the center of the train, and angle it towards point A.


Place an A[0,Channel+2] in the door near point A, and lower the door's ceiling to the floor (it must be initially closed). Place an A[0,Channel+1] in the door near point B and leave the door initially open.


When you activate the Switch, the train will pull up to point A and the door at point A will open. Hop on the train and hit the Switch. The door at point A will close, and the train will pull up to point B and the the door at point B will open. If you hit the switch one more time, the door at point B will close, and the train will return back to point A and the door at point A will open again. This back-and-forth cycle repeats indefinitely.


  • The ceiling doors are not mandatory, you can exclude them (or swap them with something else) if you want. In fact, the Two-Way Train's ability to activate other effects makes it a perfect candidate for creating 'timed' effects (airlocks for example). This is done by setting up a train which the player will never see, and linking it to the Activators you wish to 'time'. The length of the track determines the amount of time before an effect is activated.
  • Any Activators tagged [0,Channel+2] will activate when the train reaches/leaves point A. Any Activators tagged [0,Channel+1] will activate when the train reaches/leaves point B. Note that you could plug one or both of those Activators into the train itself to create a 'self-oscillating' train effect.
  • The angle of the S determines the direction that the train will travel to find Locator A. The train will travel in the exact opposite direction to find Locator B. This is not limited to horizontal or vertical angles.
  • Place an M[BSound,ASound] (in the same sector as the S) for activation sounds. Each sound will play when the train is travelling to that respective Locator.
  • The train will only travel in a straight line (this includes diagonals), regardless of the Locators' positions.
  • The train does not necessarily have to start between point A and B.
  • The train requires distance to gain momentum or else it will stop prematurely. Don't make the track too short, and construct the train initially closer to Locator B.
  • The Two-Way Train must be contained within the track sector, and the track cannot be split into multiple sectors. The track sector is still allowed to be complex, the important thing is that both of the Locators are contained within the same sector.
  • All nested sectors in the train must be contained within a single bounding sector containing the S. The nested sectors must not interfere with the bounding sector's bordering walls, i.e. Do not split the bounding sector into multiple parts. Check the original maps for examples.
  • All nested sectors within the train must also be tagged [0,31].
  • Sprites will only move with the train if they are within the bounding sector containing the S. Two-Way Trains can carry any sprite regardless of relative alignment or position, and no jittering glitches will occur.
  • You cannot control the speed of a Two-Way Train.
  • Vehicles cannot move up or down slopes.
  • You cannot place Recon Patrol Vehicles and Two-Way Trains in the same map.

Return to top