Making a switch
Switches are basically just linedef types that can trigger certain things - such as doors - remotely, as opposed to walking up and manually triggering them. In addition to doors, you can make a switch activate lifts, bridges or other effects in a completely different area. However, in Doom, a separate switch can only have a single linedef type.
There is a multitude of ways to trigger a switch. The ways are dictated by the linedef types that usually have a two-character prefix on them indicating the method of activation, such as S1, WR, or DR. There is more information on activation methods at the bottom of this article.
The example for this tutorial is pretty much the same as for the tutorial on making doors, but, rather than opening the door manually, you will use a switch.
Start out by making two rooms, with a door (labeled as sector A in the diagram to the right) connecting them in the middle. Lower the ceiling of the door sector to be equal to that of the floor. You also need to give this sector a free tag number, let it be 1.
Now, you have the door set up in the needed way, so all that is left is to make a switch. Make a linedef somewhere in the map (highlighted in green on the diagram), where the player can trigger it. Give that linedef a type of 103 ("Switch once / S1: Open door that stays open"). Also, give the switch a sector tag that is equal to the door sector. In this case, it is tag 1.
Basically, what you have done is told the switch linedef to open the door. As a final effect, you need to give the line one of the switch textures. They usually all start with SW1 or SW2. These textures change when you trigger a linedef.
You are done. To produce more special cases, have a look at the next section.
Below, there are the four ways of triggering. The corresponding letter appears as the first character on the prefix.
- D - Manual door (activates sector beyond the front side of the linedef, no tag required)
- S - Player presses 'use' on linedef
- W - Player walks over linedef
- G - Player or monster shoots linedef (hitscan attack only)
The second character determines, whether the linedef type is repeatable or not.
- 1 - Can be triggered once
- R - Can be triggered multiple times