Knowledge Base - A Filling Basin

A Filling Basin

Basin Before FillingBasin FillingBasin After Filling
Figure 1: A Basin Being Filled

The Transfer Heights special is used quite commonly for making the deep water effect. However, by using the Transfer Heights along with a moving floor, you can fill a basin with liquid when triggered by the player. The demo has the wad file illustrated in Figure 1 showing a basin filling with blood.

Map Layout
Figure 2: Map Layout

The first step is to create the basin and model sector in the same manner as the traditional deep water effect. However, make the model sector's floor and ceiling heights the same as the basin. In the demo the basin has a floor of -25 and a ceiling of 128. The model sector has the same floor and ceiling heights.

This sets up the basin and the rest is handled by a straight forward script:

#include "zcommon.acs"

int filled;

script 1 (void)
    // Only fill once.
    if (filled == 0)
        // Here the blood is spilling from the opening down the wall.
        SetLineTexture(1, SIDE_FRONT, TEXTURE_BOTTOM, "BFALL1");
        // The floor of the trough turns to blood.
        ChangeFloor(3, "BLOOD1");
        // Here we change the sides of the trough to blood stained.
        SetLineTexture(2, SIDE_FRONT, TEXTURE_BOTTOM, "MARBLOD1");

        // Now the blood is spilled over into the basin.
        SetLineTexture(3, SIDE_FRONT, TEXTURE_BOTTOM, "BFALL1");

        // The basin floor becomes blood.
        ChangeFloor(1, "BLOOD1");

        // This will cause the blood to fill the basin.
        Floor_RaiseByValue(2, 4, 17);

        // Wait till the floor is finished moving.
        // Restore the spill way back to its original textures.
        SetLineTexture(1, SIDE_FRONT, TEXTURE_BOTTOM, "MARBLE1");
        ChangeFloor(3, "DEM1_5");
        SetLineTexture(2, SIDE_FRONT, TEXTURE_BOTTOM, "MARBLE1");
        SetLineTexture(3, SIDE_FRONT, TEXTURE_BOTTOM, "MARBLE1");

        // Set the fill flag.
        filled = 1;
Listing 1: Basin Filling Script

The script changes the textures of the walls and floor of the spill way to simulate the blood flowing down the wall. Then the basin floor texture is changed to the blood texture and the floor of the model sector is moved upward. This causes the floor of the basin to appear to rise, filling the basin.

By adding some appropriate sound effects, this simple script can a lot of atmosphere to any level.


ZDoom reference by Marisa Heit.