Linedef executor

From SRB2 Wiki
(Redirected from Linedef executor trigger)
Jump to navigation Jump to search

Linedef executors are a linedef-based scripting system that allows mappers to create dynamic events in a level, such as opening doors, displaying on-screen messages, or changing the sky and the weather. Linedef executors are made up of three parts: a trigger sector, a trigger linedef and one or more commands. The trigger sector is an in-level sector that controls when the linedef executor is executed, for example when a player enters the trigger sector. This in turn activates the trigger linedef, which is placed in a control sector outside the level boundaries. The trigger linedef checks some additional conditions to determine if the linedef executor is executed at all. Finally, the commands are additional linedefs in the control sector which control what happens. If the conditions are met, all linedef executor commands in the trigger linedef's sector are run, creating the dynamic effect.

Trigger sector

The trigger sector is what sets off the linedef executor. The exact situations in which the linedef executor should be activated are specified through the trigger sector's sector type. The simplest case is the "Anywhere in Sector" type, which will activate the linedef executor if a player is somewhere inside the trigger sector. Other variations include requiring all players to be inside the sector, requiring the player(s) to touch the floor, or requiring a pushable Object to be inside the sector.

Sector types

The sector types for trigger sectors are all part of the sector type group 2. The following sector types are available:

Sector type Condition(s) Description
16 Pushable Objects Will trigger if a pushable Object (e.g., a gargoyle or snowman) touches the floor of the trigger sector.
32 Anywhere in Sector, All Players Will trigger if all players in the game are inside the trigger sector. The players do not need to touch the floor.
48 Floor Touch, All Players Will trigger if all players in the game are touching the floor of the trigger sector.
64 Anywhere in Sector Will trigger if at least one player is inside the trigger sector. The player does not need to touch the floor.
80 Floor Touch Will trigger if at least one player is touching the floor of the trigger sector.
96 Emerald Check Will trigger if at least one player who is holding all 7 Chaos Emeralds is inside the trigger sector. The player does not need to touch the floor.
112 NiGHTS Mare Will trigger if at least one player who is NiGHTS Super Sonic is inside the trigger sector. The player does not need to touch the floor. The length of the control linedef is used to specify the NiGHTS mare(s) on which the linedef executor can be triggered.

Trigger linedef

Once the trigger sector is activated, it calls the trigger linedef. The trigger linedef has two tasks: It determines how often the linedef executor can be activated and it can also check additional conditions to determine if the linedef executor is run or not. Both the trigger frequency and the conditions are specified through the trigger linedef's linedef type. With some conditions, additional parameters are set through the trigger linedef's properties, such as length. For further details on how to set up a specific trigger linedef, consult the corresponding article.

The trigger linedef should be part of a control sector outside the level boundaries. To link the trigger sector and the trigger linedef together, they should have the same tag. Alternatively, there are a few situations where no trigger sector is needed: The "Level Load" trigger linedef type will activate the linedef executor as soon as the level loads. The Lua function P_LinedefExecute or the Object action A_LinedefExecute can also be used to call the trigger linedef directly.

Trigger frequency

In addition to checking other conditions, the trigger linedef also determines how often the linedef executor can be run. There are three variations:

  • Continuous: The linedef executor is run continuously for every tic as long as the trigger sector is activated.
  • Each Time: Once the trigger sector is activated, the linedef executor is run once, but then not again for as long as the trigger sector stays activated. If it is activated again later, the linedef executor is run once more.
  • Once: The linedef executor is only run once the first time the trigger sector is activated. Afterwards, it will not be run again until the map is reloaded (if the player dies, for instance).

Trigger conditions

The following conditions can be checked by the trigger linedef. Only certain combinations of trigger frequency and condition are available:

Condition Linedef type Description
Continuous Each Time Once
None 300 301 302 Triggers if the trigger sector is activated; no further conditions are checked.
Ring Count 303 304 Only triggers if the triggering player is holding a certain number of rings.
Character Ability 305 306 307 Only triggers if the triggering player has a certain special ability.
Race Only 308 Only triggers if the current gametype is Race.
CTF Red Team 309 310 Only triggers if the current gametype is CTF and the triggering player is on the red team.
CTF Blue Team 311 312 Only triggers if the current gametype is CTF and the triggering player is on the blue team.
No More Enemies 313 Only triggers if no enemies are present in a specified area.
Number of Pushables 314 315 Only triggers if a certain number of pushable Objects (such as gargoyles) is present in the trigger sector in addition to the triggering player.
Condition Set Trigger 317 318 Only triggers if a certain condition set trigger ID has been activated by a Condition Set Trigger linedef executor.
Unlockable 319 320 Only triggers if a certain unlockable has been unlocked.
Trigger After X Calls 321 322 Only triggers after it has been called a specified number of times.
NiGHTSerize 323 324 Triggered when the player turns into NiGHTS.
De-NiGHTSerize 325 326 Triggered when the player stops being NiGHTS (runs out of time).
NiGHTS Lap 327 328 Triggered when the player does the specified number of laps around the specified mare.
Ideya Capture Touch 329 330 Triggered when the player touches the Ideya Capture of the specified mare.
Player Skin 331 332 333 Triggered only by players with the specified skin.
Object Dye 334 335 336 Triggered only by Objects with the specified color.
Level Load 399 Triggers as soon as the level loads. Unlike the other trigger linedef types, no trigger sector is necessary to activate this one.

Execution order

Once the trigger linedef is activated, the game runs the linedef executor commands in the control sector in a cyclic fashion, starting with the one adjacent to the trigger linedef and then continuing with the rest until it performs a full loop around the control sector. If the control sector was built with a clockwise orientation, the commands are executed by going clockwise around the sector; otherwise they are executed by going counter-clockwise. Thus, if you want several commands to be executed in a specified order, make sure to set them up in that order in the control sector.

If Flag [10] / Repeat Midtexture / Effect 5 of the trigger linedef is checked, the game goes through the commands in the order of their linedef numbers instead. Internally, this can be executed faster than the default order, so if performance is an issue and the order in which the commands are executed is irrelevant, it is a good idea to check Flag [10] / Repeat Midtexture / Effect 5.

Commands

The linedef executor commands determine what happens once the linedef executor is run. Once the trigger linedef is activated, all commands in the control sector that contains the trigger linedef are run. The actual effect depends on the linedef type; see below for a list of available commands. Many linedef executor commands can be customized with parameters that are set through the properties of the linedef or the control sector, such as linedef length, X/Y distance, textures, offsets, flags or the sector's floor/ceiling height. For further details on how to set up a specific linedef executor effect, consult the corresponding article.

Command list

Additional effects

If Flag [3] / Upper Unpegged is checked on any linedef executor command, the linedef executor will be delayed by an amount of time specified by the sum of the floor and ceiling height of the linedef's back sector. For more information, see the Timed linedef executor/Upper Unpegged tutorial.

See also