Tutorials Making Switches - MagnumMacKivler/trakpak3 GitHub Wiki

Back to Hammer Tutorials

Making switches with Trakpak3 is a much simpler process than in previous trakpaks, and only requires two entities: the switch itself, and a lever to throw it.

Imgur

  1. Spawn a switch (tp3_switch) into the map. Set the switch's model in the Model (Main/Normal) keyvalue. Generally, you want this model to have an _mn suffix. You can leave the Model (Diverging/Reverse, Optional) keyvalue blank if it does.

  2. Spawn a lever (tp3_switch_lever_anim) into the map. Set the lever's model to whichever switch stand you want. Models designed to work with switches will have a _left or _right suffix depending on which way the Diverging/Reverse track is supposed to go. To make sure you have the correct model chosen, check the small chevron located near the switch stand in the top-down view in Hammer.

For additional guidance on orienting your switch stand, please see this page.

Imgur

  1. Set the rest of the properties for the lever. The most important one is the Name. For setting bodygroups and skins, consult the BGAS tables for the model chosen.

Imgur

Most of the other keyvalues can be left alone, generally. These are some ones that you may wish to change, for special switches:

  • Throw Diverging/Reverse Seq and Throw Main/Normal Seq: These set the animation names used by the lever when in motion. You won't need to change these often, but some models have alternate sequences (for example, the GRS Model 5 has alternate sequences for faster throw operation).

  • Initial Position: If for some reason you wanted the lever to "start" in the Diverging position, set this keyvalue. The lever will automatically throw to that position as soon as the map loads.

  • Trailing Switch Behavior: This keyvalue controls what happens when a train runs against, or "trails", the switch. There are four options: Manual, Derail, which will derail offending trains; Manual, Break, which will throw the switch but break the stand, necessitating a time-out or repairing the stand by pressing +Use on it; Safety Throw, which will throw the switch AND the lever completely; and Spring Switch, which will partially throw the switch, returning to its old position after the train has passed through completely.

  • Auto-Reset?: If set, this keyvalue will automatically throw the lever back to its Main/Normal position when a train has passed over the switch entirely.

  • Bodygroups (Main/Normal, Motion, Diverging/Reverse): This is similar to the Bodygroups keyvalue except that these will apply every time the lever changes states. These are used for certain bodygroup-operated features like the locking chain on the Racor 22 or the SPI on the GRS Model 5.

  • Linked Switch Stand: If making a crossover, which requires two switches to be thrown at once, set this keyvalue to the other lever to synchronize them. Note: the connection is two-way, meaning you only need to set this on one of the two levers.

  • Automatic Only: This keyvalue prevents people from operating the lever simply by pressing +Use on it, or by using Remote Switcher. The lever can still be controlled by Dispatch Boards, Hammer I/O, or Wiremod.

  1. Open the switch's properties menu and configure the properties. Set the Switch Stand keyvalue to the name of the lever. Note that each lever can only control one switch... if you have multiple switches linked to one lever, it will throw an error in-game! If this happens, use the console command tp3_switch_debug to find the offending switches easily.

The only other keyvalue that needs attention here is Use Trigger For Occupancy. Normally, switches only detect trains being "on" them if they are between the blade ends (or the origin) and the frog. However certain switches, like crossovers, or any switch with a straight path (not a problem for curved paths) that extends far past the frog (>48 units) should have this set. If you don't set this, players may be able to throw the switch and there won't be a physics mesh underneath the wheels when it switches!

The rest of the switch's keyvalues (except Skin) should be left alone for most switches.

Imgur

And that's it! Once you compile your map, the switch should be ready to use.

Imgur