SRB2 Doom Builder tutorial/Special effects and tagging
|This article or section should contain one or more images. Please spruce up the article by adding an image.|
Now that you know everything about basic sector editing, we will take a look at more complicated material: floating platforms, water, and other special effects. You will learn how to apply special effects to linedefs and sectors, and how to manipulate in-level sectors through the use of control sectors and tagging.
The easiest type of special effect is the one that can be directly applied to sectors. As you might remember from the second chapter, each sector has a "Sector Effect" box in its properties window. Here you can specify several effects. Most of them need other additional settings to work, but some work on their own, most notably the ones in the upper left box. To try it out, draw a new sector and give it a
PIT floor texture, as well as an effect number of 7. As you can see, the upper left box now has the title "Death Pit (No Camera Tilt)". If you test the level and touch the floor of this sector, you will die.
Another prominent example of a sector effect is the "Exit Sector/Special Stage Pit/Return Flag" effect, which has the number 8192. This special is responsible for ending the level in Single Player mode when it is touched. In Special Stages, it will cause an instant time over upon touching, and in CTF, it will return flags that touch the floor to their base. Sector specials can also be combined. For example, if you combine the death pit special with the return flag special (which equals an effect number of 8199), the flag will be returned to the base in CTF if a flag carrier dies in the sector.
Just like sectors, linedefs can have effects applied to them. Most of them are used for more complicated settings that will be explained later on, but some can be applied to the linedefs themselves to produce an effect on them. For example, select all the inner linedefs of the thok barrier and type "500" into the "Linedef Action" field in the properties window. If you now click on "Select Action...", you will see that we selected the "Scroll Wall Front Side Left" effect in the "Wall Scrolling" category. The linedefs have now turned green to signify that they have an effect, and if you test the stage, the outer walls will continually scroll to the left. (If you have constructed the thok barrier in such a way that the linedefs face outward, you cannot see the effect, since only the front sidedefs scroll. In this case, flip them with the "Flip Linedefs" tool.)
Another example of such a linedef effect are translucent walls. These effects, whose numbers are in the 900s, make the middle textures of a linedef translucent to a certain degree. If you still have the sector with the middle textures from Chapter 3 (if not, recreate it), give its linedefs effect 904. This will make the middle textures 50% translucent. Lower and upper textures, however, are not affected and stay as they are. If you test the stage now, you will be able to see through the formerly opaque middle texture walls.
Tagging and control sectors
Most linedef specials don't work like the examples above, since most of them modify the behavior of sectors and not of linedefs. Therefore, the effects are not applied to in-level linedefs, but to linedefs in separate sectors created outside of the main map. Those sectors are called control sectors. They are then linked to the sectors that should have the effect via the Sector Tag that we discovered earlier. As an example of this method, we will create an FOF. FOF stands for Floor Over Floor and is the name for floating platforms in SRB2. Since a normal sector only has one floor and ceiling, a floating platform would normally not be possible. We can change this with the use of control sectors.
Start off by creating a new square sector in the main map. This defines the shape of our floating platform. Right-click on the sector and click on the Next Unused button next to the "Tag" field. Since we haven't used a tag yet, a "1" will appear in the box. This sector now has a tag of 1. This means that any linedef with a tag of 1 will apply its special effect to this sector. The special effect is determined by the linedef type, and such a linedef is called a control linedef. The sector that the effect is applied to is called a target sector. You can have several different control linedefs that have the same tag, but then they will all affect the same sector. You can also have several target sectors with the same tag, in which case the same special effects will be applied to all of them. If you give a control linedef a tag of 65535 (or -1), its special effects are applied to all sectors without exception, which is sometimes useful for visual effects.
The next step is to create a new sector outside the main map, or in other words, beyond the thok barrier. The size and shape of this sector doesn't matter (at least not for the FOF effect), but most mappers prefer a square with sides that are 32 fracunits long, or a triangle that is basically the square cut in half on the diagonal. One of the linedefs of that sector will now serve as the control linedef, but it is up to you to decide which one. Right-click on that linedef and give it a tag of 1. Now give it an effect of 100. This creates a typical FOF: It is solid on all sides and flats, completely opaque, and it can cast a shadow.
Now we need to define the appearance of the FOF. Firstly, you must set the textures shown on its sides. FOFs are programmed in a way that doesn't allow different textures on its sides; instead, the same texture will be shown on all of them. This can be changed by setting the Transfer Line flag, but that process is rather complicated and will not be explained here. The texture shown on the sides is the middle front texture of the control linedef (control linedefs normally don't have a back side anyway). In the sidedefs tab, choose a texture of your choice (we'll use
GFZROCK for this tutorial).
The other properties are set in the sector properties menu of the control sector. The control sector's ceiling is the top side of the FOF, while the floor is the bottom side. Thus, the floor and ceiling height determine where the FOF will be positioned. Choose heights of 64 and 96, so that the player can jump of top of it. For the flats, choose
GFZFLR01 to go along with the sides. You can also lower the brightness of the sector by one step, which will make the FOF cast a shadow.
Water, just like floating blocks, is made with FOFs. The difference lies in the linedef type that is used for it. There are several different choices for water, depending on what effect you want, but for this tutorial, we will use linedef type 121. This is a water block with translucent surfaces in which all sides and flats are rendered. Water blocks can theoretically float anywhere in the air, but to create a realistic effect, you should create a pit and then "fill it up" with water. Make the pit reasonably large so that the player can comfortably stand inside it and look around. Give the pit sector the next unused tag (it should be 2 if you followed this tutorial).
Create another control sector like you did before. You must now specify some properties to create the water block you want, of course. The control linedef should have type 121 and be tagged to the water pit. The floor height should be the same as the floor height of the pit. The ceiling height should be 8–16 fracunits below the surface of the pit. Water doesn't normally fill up a pool to the brim, so you should leave a bit of space. For the ceiling flat, choose a water surface, such as
FWATER01. For the floor flat however, use the same flat as the bottom of the pit. Otherwise, the bottom will look as if it has a water surface on it, which looks weird. Since the sides of the water block will be obscured by the sides of the actual pit, you theoretically don't need a texture on the control linedef. If you want one, use
GFALL1 to match the surface.
Now you should have a working water block. However, if you step into it, you will see that it doesn't have a blue hue to it like the water in the official SRB2 levels. This color is applied with a linedef effect called Colormap. We will now apply a blue colormap to our water pool. You can either make a new control sector for the colormap or use a linedef on the same sector that creates the water block. Give that linedef type 606 and a new tag (which is probably 3). Since we want to apply the effect to our water block, which is represented by its control sector, we must tag the effect to the control sector. Therefore, give the control sector for the water block the same tag. Now enter #40A0FFJ into the front upper texture field of the new control linedef. This is a not an actual texture, but rather a color code that stands for the mild blue tint used for water in SRB2. Now your water should be blue.
Liquids that damage the player, such as lava, are rather easily made. To transform our water pit into a lava pit, only a few changes need to be made. The shape stays the same, so the heights are unchanged. The surface flat should be changed to
RLAVA1 and the side textures (if used) to
RVZFALL1. The colormap code should be changed to #FF7F00Z. The most important change, however, and the one that makes the lava damage the player on contact, is to use the fire damage sector type on the FOF control sector. Simply give it an effect of 3 and it will act like damaging lava.
Control sector parameters
Depending on what effect you want to use, there are several properties of the control sector or the control linedef that will be used as parameters. Most of them are self-explanatory, such as linedef length or floor height. Other parameters include the direction the linedef (as a reminder, the notch always faces to the right of the linedef) and the texture offsets of both sidedefs. The flags of the control linedef are frequently used for optional features. The effects of those flags, as well as what else needs to be done to get the effects to work, are described in the separate articles for all the linedef types.
A slightly more complicated concept is that of X and Y distance (or X and Y length) of a linedef. It is frequently used for more complicated effects to split the linedef length into two parameters. Basically, the X distance is the distance of the two vertices measured only on the X axis (left to right), while the Y distance is the distance of the two vertices measured only on the Y axis (up to down). You should never make a linedef diagonal when the normal length is required as a parameter, since the game might calculate the wrong value in that case. Linedef length and X/Y distances are never used as parameters at the same time.
Sometimes, several sector specials and linedef specials need to be combined to produce a more complex effect, especially when using linedef executors. These are special effects that can be triggered by the player while playing the level. For example, one could make a door open when standing on a button. In that case, you would need a sector effect on the button to trigger the effect, as well as a control linedef tagged to the button that executes the effect. Linedef executors are not explained here, however, but in a separate tutorial.