Linedef executor
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
- Linedef type 400: Set Tagged Sector's Floor Height/Texture
- Linedef type 401: Set Tagged Sector's Ceiling Height/Texture
- Linedef type 402: Set Tagged Sector's Light Level
- Linedef type 403: Move Tagged Sector's Floor
- Linedef type 404: Move Tagged Sector's Ceiling
- Linedef type 405: Move Floor According to Front Texture Offsets
- Linedef type 407: Move Ceiling According to Front Texture Offsets
- Linedef type 409: Change Tagged Sectors' Tag
- Linedef type 410: Change Front Sector's Tag
- Linedef type 411: Stop Plane Movement
- Linedef type 412: Teleporter
- Linedef type 413: Change Music
- Linedef type 414: Play Sound Effect
- Linedef type 415: Run Script
- Linedef type 416: Start Adjustable Flickering Light
- Linedef type 417: Start Adjustable Pulsating Light
- Linedef type 418: Start Adjustable Blinking Light (unsynchronized)
- Linedef type 419: Start Adjustable Blinking Light (synchronized)
- Linedef type 420: Fade Light Level
- Linedef type 421: Stop Lighting Effect
- Linedef type 422: Switch to Cut-Away View
- Linedef type 423: Change Sky
- Linedef type 424: Change Weather
- Linedef type 425: Change Object State
- Linedef type 426: Stop Object
- Linedef type 427: Award Score
- Linedef type 428: Start Platform Movement
- Linedef type 429: Crush Ceiling Once
- Linedef type 430: Crush Floor Once
- Linedef type 431: Crush Floor and Ceiling Once
- Linedef type 432: Enable/Disable 2D Mode
- Linedef type 433: Enable/Disable Gravity Flip
- Linedef type 434: Award Power-Up
- Linedef type 435: Change Plane Scroller Direction
- Linedef type 436: Shatter FOF
- Linedef type 437: Disable Player Control
- Linedef type 438: Change Object Size
- Linedef type 439: Change Tagged Linedef's Textures
- Linedef type 440: Start Metal Sonic Race
- Linedef type 441: Condition Set Trigger
- Linedef type 442: Change Object Type State
- Linedef type 443: Call Lua Function
- Linedef type 444: Earthquake
- Linedef type 445: Make FOF Disappear/Reappear
- Linedef type 446: Make FOF Crumble
- Linedef type 447: Change Tagged Sector's Colormap
- Linedef type 448: Change Skybox
- Linedef type 449: Enable Bosses with Parameter
- Linedef type 450: Execute Linedef Executor (from Tag)
- Linedef type 451: Execute Linedef Executor (Random Range)
- Linedef type 452: Set FOF Translucency
- Linedef type 453: Fade FOF
- Linedef type 454: Stop Fading FOF
- Linedef type 455: Fade Tagged Sector's Colormap
- Linedef type 456: Stop Fading Tagged Sector's Colormap
- Linedef type 457: Track Object's Angle
- Linedef type 458: Stop Tracking Object's Angle
- Linedef type 459: Control Text Prompt
- Linedef type 460: Award Rings
- Linedef type 461: Spawn Object
- Linedef type 462: Stop Timer/Exit Stage in Record Attack
- Linedef type 463: Dye Object
- Linedef type 464: Trigger Egg Capsule
- Linedef type 480: PolyObject – Door Slide
- Linedef type 481: PolyObject – Door Swing
- Linedef type 482: PolyObject – Move
- Linedef type 483: PolyObject – Move, Override
- Linedef type 484: PolyObject – Rotate Right
- Linedef type 485: PolyObject – Rotate Right, Override
- Linedef type 486: PolyObject – Rotate Left
- Linedef type 487: PolyObject – Rotate Left, Override
- Linedef type 488: PolyObject – Move by Waypoints
- Linedef type 489: PolyObject – Turn Invisible, Intangible
- Linedef type 490: PolyObject – Turn Visible, Tangible
- Linedef type 491: PolyObject – Set Translucency
- Linedef type 492: PolyObject – Fade Translucency
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.