Timed linedef executor/Gargoyle box

From SRB2 Wiki
Jump to navigation Jump to search

This tutorial will explain how to set up a timed linedef executor through the use of a gargoyle box. A gargoyle box is a room hidden from the player's view in which a pushable Object, usually a gargoyle, is moved around using plane scrollers. Trigger sectors are placed in the gargoyle's path, causing linedef executors to be triggered when the gargoyle passes them.

Gargoyle boxes are particularly suited for creating looped sequences of dynamic events in a level, such as the periodically rising and falling water in Tidal Palace Zone. An alternative to gargoyle boxes is to delay linedef executors via the Upper Unpegged flag. See Timed linedef executor > Comparison for a comparison of the two methods.

Setup of a typical gargoyle box

This section will teach you how to set up a typical gargoyle box. As an example, we will create a gargoyle box that periodically raises and lowers a series of four pillars. It will go around the pillars in a clockwise manner, always raising one and lowering the previous one at the same time.

Setting up the main map

Start by creating a simple test map and then add four sectors to it like in the following image:


These will be the pillars that the gargoyle box will raise and lower. As in the image, go around the sectors in a clockwise manner and give each one a new tag, starting at tag 1 with the top right one and ending at 4 with the top left one. Initially, all sectors should have the same floor height as the surrounding sector. However, since the gargoyle box will later raise their floors, you should add lower textures to their outer sides.

Creating the gargoyle box

Now that the main map has been created, you need to build the gargoyle box. Create a moderately sized square sector outside the main map, for example 512×512 fracunits large. The gargoyle will be moved around the edges of this box. Create stripes along the edges like in the following image:


Place a gargoyle in the upper left corner of the gargoyle box, at the start of the left stripe. To make it move, we will add floor scrollers to the four outer stripes. Give each of the stripe sectors a new tag: Start with 5 at the top stripe and then continue clockwise until you end up with tag 8 at the left stripe.

Moving the gargoyle

Floor scrollers can be created with linedef type 530, Scroll Floor Texture and Carry Objects. The floor texture doesn't actually need to be scrolled, so you can also use linedef type 520, which will only carry objects. However, we will use linedef type 530 here to make it easier to see how the gargoyle box works in-game. To set up the scrollers, create a new square sector of size 256×256 and give each of its linedefs type 530. Tag each linedef to one of the stripe sectors, starting with tag 5 at the top linedef and continuing clockwise until you end up with tag 8 at the left linedef.


If you test the map now and add a Player 1 Start to the gargoyle box so you can see inside it, you will notice that the outer stripe sectors now move the gargoyle around the box in a clockwise fashion. The directions of the scroller linedefs control the scrolling direction, while the length controls the scrolling speed. The scrolling speed is what will eventually control the timing of the linedef executors.

Setting up the linedef executors

The gargoyle box itself is now fully operational, but we still need to add the linedef executors that create the actual effects. We will use each of the four outer stripe sectors as a trigger sector, so give each of them sector type 16, Trigger Linedef Executor (Pushable Objects). Now the sectors will trigger linedef executors when the gargoyle enters them.

To set up the linedef executors, create four control sectors, one for each trigger. Select one linedef in each control sector and give them linedef type 300, Trigger Linedef Executor – Continuous. Tag each linedef to one of the trigger sectors; in other words, give them tags 5–8. Now you can set up the effect: In each control sector, select one linedef and give it linedef type 403, Move Tagged Sector's Floor. The control sector's floor height sets the height that the tagged sector's floor is moved to. For this tutorial, use 128. The control linedef's length sets the speed at which the floor is moved; a good value for this is 64. Now tag each linedef to one of the in-level pillar sectors with tags 1–4. The pillars should be raised in a clockwise manner, so the trigger sector with tag 5 should raise the pillar with tag 1, the one with tag 6 should raise the one with tag 2, and so forth.

To lower the pillars again, add four more control sectors. These are set up like the previous four ones, with two differences: The floor heights of the control sectors are set to 0 so that the pillars are lowered in the ground again. Also, the tags need to be changed so that the linedef executors always lower the pillar that was raised in the previous step. The trigger sector with tag 5 should lower the pillar with tag 4, the one with tag 6 should lower the one with tag 1, and so forth. If you test the map now, the pillars should be raised and lowered as intended.


Trigger type

Note that we used a "Continuous" trigger type instead of an "Each Time" type, which would be more appropriate for this situation. This is because pushable Objects cannot activate "Each Time" triggers. In our case, this isn't a problem because linedef type 403 still works as expected when it's triggered every tic. However, if you are using effects where this makes a difference, you need to find a workaround. One approach is to make the trigger sector thin enough that the gargoyle only stays in it for one tic, but this can be difficult to achieve.

Another approach is to use invisible, intangible FOFs as trigger sectors for the linedef executors. Once an FOF has been entered, you can use linedef type 400 and linedef type 401 to immediately move it out of the gargoyle's reach. This way, the gargoyle will only be inside the FOF for one tic. To move the FOF back down into its previous position, you can add another trigger sector right behind the FOF. Once the gargoyle leaves the sector containing the FOF, it will enter this trigger sector, which you can configure to move the FOF back to its original position.

Configuring the gargoyle box

The gargoyle box made in the previous section can be easily adapted to other scenarios: If you need more than four individual effects, you can split the existing trigger sectors into multiple sectors each. Keep in mind that the additional trigger sectors will also need additional control linedefs to set the scrolling effect. You can change the delays between the individual effects by changing the length of the scroller linedefs, but make sure to preserve their direction.

Non-looping sequences

Gargoyle boxes are typically used for effects that run in infinite loops, but you can also use them for sequences of effects that don't loop. In this case, you will need to modify our example setup, for example by disabling the scroller on the last outer strip that leads back to the first one. This way, the gargoyle will simply stay in place after exiting the last scroller, thus ending the sequence.

If you want to create sequences that don't loop but can be executed multiple times (for example, every time the player presses a button), you can add a teleporter to the area after the last scroller that is set up to teleport the gargoyle back to the beginning of the scroller sequence. Then you can restart the sequence by activating the teleporter.

Dynamically changing the delays

If you want to change the duration of the delays between the individual linedef executors at runtime, you need to change the speed of the scrollers. The default scrollers which we used in our example setup cannot change their speed at runtime, so you need to use accelerative scrollers such as linedef type 532 instead. Accelerative scrollers use the floor and ceiling height of a target sector to determine their speed, allowing you to use linedef executors to change it.

Dynamically stopping and starting the gargoyle box

Our example gargoyle box starts immediately once the level is loaded and continues indefinitely until the level ends. If you want to make it possible to start and stop the execution of the gargoyle box dynamically, you need to use accelerative scrollers whose speed can be modified at runtime, such as linedef type 532. Setting the speed to 0 will interrupt the gargoyle box, while setting it to any other speed will (re)start it.

Dynamically changing the effects

Through the use of linedef type 409, Change Tagged Sector's Tag, you can dynamically enable/disable specific effects that are part of the gargoyle box. To disable an effect, change the tag of its trigger sector to an unused tag. You can then re-enable it by changing it back to its original tag. By changing the tags of the trigger sectors, you can also change the order of the effects in the gargoyle box.


Example file: ex_gargoylebox.wad (MAP01)
How to use
  • You may load this file into your favorite map editor, such as Zone Builder. Select MAP01 as the map to load.
  • You may also load this file in the game:
    1. Save ex_gargoylebox.wad into the addons folder of your SRB2 directory.
    2. Start SRB2, go to the Addons menu, and then select ex_gargoylebox.wad.
    3. Start the game in Single Player mode.
    4. Press the Console button (~), and type in the command MAP MAP01 to access the example map.
  • When you load this file in the game, it replaces Greenflower Zone Act 1.