Tagging is the process of associating sectors with linedefs in order to achieve a variety of special effects. This is done by assigning to each the same whole number called a tag. A sector having the same tag as a linedef is said to be tagged to that linedef, and vice versa.
Very many of SRB2's special effects are achieved by tagging. Indeed, the normal way to apply a special linedef effect to a sector is to tag them together. For example, FOFs are created by tagging a FOF-effect linedef to the target sector where the FOF is to appear, and linedef executor trigger sectors and trigger linedefs are tagged to one another. If it is not specified, it is to be assumed that this is the method of applying a linedef effect to its target; where there is an exception (for example, with linedef executor actions), this will be noted in the appropriate article.
By convention, a tag of 0 is used for untagged objects. However, if a control linedef has a specified action, as well as a tag of 0, it will be applied to anything with tag 0. Tag 65,535 on the contrary affects all sectors in a map, even control sectors.
The FOF example wad provides a typical example of tagging.
- A tag is a whole number between 0 and 65,535. It may be chosen freely by the map designer. However, there are several reserved tags that have hardcoded properties, and they should not be used for normal sector tagging. Note that tag numbers -32,768 to -1 may also be used to represent tags numbers 32,768 to 65,535; some map editors will accept negative tags and automatically convert them to the corresponding positive tags.
- Target sector
- A sector which is to be affected by a linedef action. It must have the same tag as the control linedef.
- Control linedef
- A linedef which creates a special effect, specified by its action property. It must have the same tag as the target sector(s).
- Control sector
- The sector to which the control linedef belongs. Often the parameters for the special effect (such as FOF heights and textures) are specified by the control sector. See control sector for more details.
Often it is desirable to have the same effect applied to multiple sectors, for example to colormap an entire level or to create one FOF spanning several sectors. This is achieved simply by setting multiple target sectors to have the same tag as the control linedef. Only a single control linedef is necessary.
Similarly, multiple linedef effects can be applied to one target sector. In this case, each linedef effect should have the same tag as the single target sector.
This principle can be extended to the case where multiple effects are required in multiple sectors. However, if different subsets of effects are required in different sectors, it is necessary to duplicate control linedefs. In most cases, however, only one control sector is needed.
Applying effects to FOFs
To apply a linedef effect to a FOF, the control linedef should be tagged to the FOF's control sector. Colormapping water blocks is a frequently-arising example. Note that not all special effects are supported on FOFs.