MM1:Rail

Rails are objects in Mary's Magical Adventure which Mary and enemies can grind on if they touch the boost panel on it.

How to Make
Making a rail requires multiple things:
 * A visible rail made using linedefs and sectors
 * A boost panel
 * Three path follower objects
 * A series of interpolation points

Map editing
First, make your "rail". There's no one way to design one, but usually it's a 3D floor with supports at corners, turns, and at the beginning and end of the rail or it's one sector that curves with no 3D floor in the official levels. The official rails are also 16 units across or smaller. Make sure there's a linedef across the rail placed where your boost panel will be later, and make the small "peg" stick out towards the end of the rail.

Object placement
Place a boost panel where the linedef is. Give it a thing ID and remember it. Next, place three path followers slightly down the rail all beside eachother, but near the boost panel for a smooth transition when the rail is "activated" by the player. Give them all a thing ID using the "new" button as well. Make sure its "type" (argument 3) is 11, which makes it follow paths linearly, use the points' angles, and makes it automatically face where it's moving.

Next is the tedious part, placing interpolation points at every change in direction; Start by placing one just in front of the path follower, similar to what you did with the path follower when you placed it. Make sure the interpolation point faces in the direction the player will go along the rail. Give this interpolation point its own thing ID then return to the path follower's properties. Go to its arguments and set its interpolation point to be the thing ID you received from the interpolation point.

Next, place down the rest of the interpolation points, keeping them angled correctly with the rail. hold while doing a right-click-drag and release each point to automatically connect it to the one you cloned it from; This makes it much easier to do this tedious part. additional interpolation point shortly before the turn (see MAP2 for an example). Another thing that must be done is setting their speed, known in GZDoom Builder as its "travel time". This determines how long it takes for Mary to reach the next interpolation point from the one you're editing. Click all of the points which will have a similar travel time then right click one you've selected to quickly edit them in bulk. Set it to 1 if they're close together, 4 if they're 256 units away, and so on. This is the most tedious part after all.

Here's a couple tips:
 * Don't add too many points around smooth curves; Keep around three on each curve unless it's a big enough radius to have enough space in-between each point.
 * Test your rail in-game to make sure the player moves at a semi-fast speed on the rail. If they go too slow over a certain section, remove points around curves or decrease the travel time.
 * Don't forget there has to be three path followers; If less are there or with given thing IDs that aren't in numerical order (for example, "1, 2, 3" or "30, 31, 32"), extra players or monsters getting on the rail may be unexpectedly thrown off the rail or may interrupt other people currently grinding on that rail.

Switch to Visual Mode and make sure every interpolation point (and the line in-between each) is on the rail. If it isn't, move them onto the rail and add more interpolation points.

Setting up the script
Now, return to the linedef you created in front of the boost panel earlier and set these up:

Script details

 * Action: 226:ACS Execute Always
 * Script (named): Rail
 * Argument 1: Thing ID of first path follower (look for the lowest thing ID of the three path followers)
 * Argument 2: Thing ID of boost panel

Activation flags

 * Repeatable action
 * Player walks over
 * Monster walks over
 * Monster presses use
 * Monster bumps
 * Front side only

If done correctly, you should have a functioning rail in-game! Make sure you walk or jump onto the front of the rail, in fron of the boost panel, and don't jump over that boost panel as it's what starts the grinding.

Optionally, set the path follower TID to a the negative counterpart of what you entered for it and the player won't be able to jump while on the rail. Monsters' scripted jumping (see below) isn't affected.

Adding monster interaction
Setting the "monster" trigger options will allow monsters to grind on the rails, but they can also be commanded to jump (if the monster in question can, like the fighter). To script a jump, add an interpolation special object and give it the same thing ID as the interpolation point you want to trigger the jump. Set its action to 226:ACS Execute Always and the named script "RailJump" with no arguments.

Place a map spot on the rail ahead of the interpolation point (but not too far, or the jump won't happen) and give it a thing ID of 618. When the grinding enemy goes near the map spot (if it's not too far away from the activating interpolation point), they will jump. If it is within a short distance and the enemy won't jump, either check their DECORATE code in MaryMagicalAdventure1.ipk3 for "Grind" and "GrindEnd" states or use an enemy like the fighter.