Linedef executors are SRB2's method for scripting interactive events. Linedef executors work by using a trigger to cause the commands to be run.
Setting up the Level
First, set up a room like the image. the small square is the button that will open the door (which should be raised above the rest of the room), and the sector on the right of the room is a door, with both the floor and ceiling set as the same as the rest of the room.
The control sector on the left is made of two sectors. Note the direction the middle linedef is pointing. It's facing away from the two linedefs with tag 1. The sector with the tag 1 linedefs should have its floor set to the same height as the floor in the room, and the other control sector should have its ceiling set to the same height as the ceiling in the room.
Setting up the Linedef Executor
Trigger
To set up the linedef executor's trigger, there are two steps:
- Select one of the linedefs in the control sector that's not the middle one and give it the linedef type 302, Trigger Linedef Executor (Once). Make sure this linedef is set to tag 1.
- Select the button sector and give it the sector type Trigger Linedef Executor - Floor Touch - All Players. Make sure this sector is also set to tag 1. In combination with the linedef, this will trigger the linedef executor the when someone touches the ground where the button is, and only once.
Commands
Now set up the two commands:
- Select the other linedef in the control sector that's not the middle one and give it the linedef type 403, Move Tagged Sector's Floor. Make sure this linedef is set to tag 1 and the floor in the sector in front of it is set to the floor for the rest of the room. This command will move the floor in the button sector to the floor in the rest of the room.
- Select the middle linedef and give it the linedef type 404, Move Tagged Sector's Ceiling. Make sure this linedef is set to tag 2 and the ceiling in the sector in front of it is set to the ceiling in the rest of the room. This command will raise the ceiling where the door is all the way to the ceiling, essentially opening the door.
Now put a Player 1 Start next to the button and try it out. If you tagged everything correctly and put the sector type on the button, it should work!
Notes
- Note that the linedef executors get their information from the sector to their front, where the little notch is displayed on the linedef in the editor. In this case we don't actually need two control sectors, since we don't need different values for each linedef executor, we could just set the ceiling and floor to the values we need in one sector. For more complicated situations, multiple sectors become absolutely necessary.
- The same setup can be used for any triggers or commands. All the commands on the same sector as the trigger linedef will be run at the same time when the trigger happens.
Sample
- Example WAD: ldexecex.wad
Notes