Knowledge Base - Building Pillars
Building Pillars
Another Hexen construct available in ZDoom is the pillar. A pillar is a sector where the floor and ceiling moves at the same time. In the split door tutorial we used the floor_raise and lower and the ceiling_raise and lower to simulate a door. In this tutorial, we create another split door, but we use the Pillar specials to simplify the scripting. The wad, pillardr.wad illustrates the use of a pillar.
Figure 1 shows the pillar in action. When the player triggers the door, a script is called using the ACS_Execute method. The script takes one parameter, the tag id of the door. This enables the script to work on any split door in the level. Here is the script:
#include "zcommon.acs" script 1 (int DoorTag) { //Open the door here. Pillar_Open (DoorTag, 16, 0, 0); Delay (120); //Close the door here. Pillar_Build (DoorTag, 16, 0); }
If you compare this script with the split door script, it is easy to see that using pillars simplifies the code.
Pillars are controlled using three specials:
- The Pillar_Build (# 29) uses three parameters:
Pillar_Build (tag, speed, distance)
- tag: the floor sector tag.
- speed: the speed at which floor and ceiling moves.
- distance: the distance the floor and ceiling moves. If this is 0, then both floor and ceiling will meet halfway from their starting positions.
- The Pillar_Open (# 30) uses four parameters.
Pillar_Open (tag, speed, fdist, cdist)
- tag: the ceiling sector tag.
- speed: the speed at which floor and ceiling moves.
- fdist: the distance the floor moves. If 0, then the pillar's floor will lower to the lowest surrounding floor.
- cdist: the distance the ceiling moves. If 0, then the pillar's ceiling will rise to the highest surrounding ceiling.
- If you want to use the pillar (or door) to be a trap, use the pillar crush special to apply damage to the player if he remains in the pillar when it closes. The Pillar_BuildAndCrush (# 94) takes four parameters:
Pillar_BuildAndCrush (tag, speed, distance, crush)
- tag: the ceiling sector tag.
- speed: the speed at which the floor and ceiling moves.
- distance: the distance the floor and ceiling moves. If this is 0, then both floor and ceiling will meet halfway from their starting positions.
- crush: the amount of damage to apply.