Triggers: Difference between revisions
m Maps/Triggers moved to Triggers: Moving the Maps/ sections' pages to main space. |
Based on conclusive testing, trigger's persistence is obsolete in TS. |
||
(14 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{WrongTitle|[Triggers]}} | {{WrongTitle|[Triggers]}} | ||
{{ | {{MappingBar}} | ||
Map triggers are responsible for the special events happening in the map. For example, the singleplayer campaign maps have triggers to do things like "if unit x is destroyed, declare player the winner" or "if building y is still standing after twenty minutes, declare the player the loser". Without map triggers, scripting maps would be impossible. | Map triggers are responsible for the special events happening in the map. For example, the singleplayer campaign maps have triggers to do things like "if unit x is destroyed, declare player the winner" or "if building y is still standing after twenty minutes, declare the player the loser". Without map triggers, scripting maps would be impossible. | ||
The internal hierarchy works like this: | The internal hierarchy works like this: | ||
*A | *A [[Maps/Celltags|CellTag]] points to a Tag, and tells the game to consider its Trigger when processing events. | ||
*A [[Maps/Tags|Tag]] points to a Trigger. | |||
*A Trigger points to an [[Maps/Events|Event]] and an [[Maps/Actions|Action]], and tells the game "If my Events happen, execute my Actions". | *A Trigger points to an [[Maps/Events|Event]] and an [[Maps/Actions|Action]], and tells the game "If my Events happen, execute my Actions". | ||
*An [[Maps/Events|Event]] lists the condition(s) that invoke this trigger, e.g. "45 seconds have passed". | *An [[Maps/Events|Event]] lists the condition(s) that invoke this trigger, e.g. "45 seconds have passed". | ||
*An [[Maps/Actions|Action]] lists the actions that should be performed by the game when this trigger fires. These are things like "Give the AI three nuclear silos", "Reveal the | *An [[Maps/Actions|Action]] lists the actions that should be performed by the game when this trigger fires. These are things like "Give the AI three nuclear silos", "Reveal the aforementioned silos to the player" or "Paradrop these desolators as a reinforcement for the player". | ||
__TOC__ | __TOC__ | ||
== Section == | == Section == | ||
=== | === <span id="td"></span>{{td}} === | ||
The {{Tt|[Triggers]}} section in a map is a list of comma-separated strings that looks like this: | The {{Tt|[Triggers]}} section in a map is a list of comma-separated strings that looks like this: | ||
<!-- | <!-- Originally reverse engineered from CCMAP, further documentation according to source code --> | ||
[Triggers] | [Triggers] | ||
ID= | ID=EventType,ActionType,EventParameter,House,Team,PersistantType | ||
ID1= | ID1=EventType,ActionType,EventParameter,House,Team,PersistantType | ||
etc. | etc. | ||
{| style="width: 90%" border=1 class="table_descrowdesccol" | {| style="width: 90%" border=1 class="wikitable table_descrowdesccol" | ||
|+ Meanings of each string | |+ Meanings of each string | ||
! style="width: 13em; " | String | ! style="width: 13em; " | String | ||
Line 36: | Line 35: | ||
| This trigger's ID. | | This trigger's ID. | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|EventType|td}} | ||
| This trigger's Event (See [[Maps/Events/TD|Events]]). | | This trigger's Event (See [[Maps/Events/TD|Events]]). | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|ActionType|td}} | ||
| This trigger's Action (See [[Maps/Actions/TD|Actions]]). | | This trigger's Action (See [[Maps/Actions/TD|Actions]]). | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|EventParameter|td}} | ||
| The parameter for the Event. | | The parameter for the Event. | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|House|td}} | ||
| The name of the [[Maps/Houses/TD|house]] associated with this trigger, or {{Tt|None}}. This house is used as a parameter by some Events and Actions. | | The name of the [[Maps/Houses/TD|house]] associated with this trigger, or {{Tt|None}}. This house is used as a parameter by some Events and Actions. | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|Team|td}} | ||
| Associated teamtype ID, or {{Tt|None}}. | | Associated teamtype ID, or {{Tt|None}}. | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|PersistantType|td}}<sup style="font-weight: normal">[''sic'']</sup> | ||
| | | | ||
Controls if and when the trigger should destroy itself after it goes off. Once destroyed, a trigger cannot be fired again. | |||
{| style="margin-left: 50px;" border=1 class='table_descrowdesccol' | {| style="margin-left: 50px;" border=1 class='wikitable table_descrowdesccol' | ||
|+ Possible values | |+ Possible values | ||
! style="width: 50px; text-align: center; " | Value | ! style="width: 50px; text-align: center; " | Value | ||
Line 61: | Line 60: | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 0 | ! style="font-family: monospace; width: 50px; text-align: center; " | 0 | ||
| | | volatile: the trigger destroys itself immediately after going off, and removes itself from all objects it's attached to | ||
| Loop : no | | Loop : no | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 1 | ! style="font-family: monospace; width: 50px; text-align: center; " | 1 | ||
| | | semi-persistent: the trigger maintains a count of all objects it's attached to, and only actually fires after its been triggered from all the objects; then, it removes itself. | ||
| Loop : and (1) | | Loop : and (1) | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 2 | ! style="font-family: monospace; width: 50px; text-align: center; " | 2 | ||
| | | persistent: the trigger is never removed, and it continues to fire whenever its conditions are met. | ||
| Loop : or (2) | | Loop : or (2) | ||
|} | |} | ||
Line 75: | Line 74: | ||
|} | |} | ||
=== | === <span id="ra"></span> {{ra}}, {{cs}}, {{am}} === | ||
The section is called {{Tt|[Trigs]}} and again is a list of comma-separated strings that looks like this: | The section is called {{Tt|[Trigs]}} and again is a list of comma-separated strings that looks like this: | ||
Line 82: | Line 81: | ||
[Trigs] | [Trigs] | ||
name= | name=P,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3 | ||
name1= | name1=P,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3 | ||
etc. | etc. | ||
{| style="width: 90%" border=1 class="table_descrowdesccol" | {| style="width: 90%" border=1 class="wikitable table_descrowdesccol " | ||
|+ Meanings of each string | |+ Meanings of each string | ||
! style="width: 13em; " | String | ! style="width: 13em; " | String | ||
! Meaning | ! Meaning | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|P|ra}}[''ersistant''] | ||
| Specifies whether this trigger is | | Specifies whether this trigger is persistent (see [[#td_PersistantType|PersistantType]] for more info). | ||
{| style="margin-left: 50px;" border=1 class='table_descrowdesccol' | {| style="margin-left: 50px;" border=1 class='wikitable table_descrowdesccol' | ||
|+ Possible values | |+ Possible values | ||
! style="width: 50px; text-align: center; " | Value | ! style="width: 50px; text-align: center; " | Value | ||
Line 100: | Line 99: | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 0 | ! style="font-family: monospace; width: 50px; text-align: center; " | 0 | ||
| | | volatile | ||
| temporary (any linked event => switch{{Fnl| | | temporary (any linked event => switch{{Fnl|2}}, destroy) | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 1 | ! style="font-family: monospace; width: 50px; text-align: center; " | 1 | ||
| | | semi-persistent | ||
| semi-constant (all linked events => switch, destroy) | | semi-constant (all linked events => switch, destroy) | ||
|- | |- | ||
! style="font-family: monospace; width: 50px; text-align: center; " | 2 | ! style="font-family: monospace; width: 50px; text-align: center; " | 2 | ||
| | | persistent | ||
| constant (any linked event => switch) | | constant (any linked event => switch) | ||
|} | |} | ||
{{Fn| | {{Fn|2|"switch" means ''activate this trigger''}} | ||
|- | |- | ||
Line 123: | Line 122: | ||
These two flags define which event fires which action: | These two flags define which event fires which action: | ||
{| style="margin-left: 50px;" border=1 class='table_descrowdesccol' | {| style="margin-left: 50px;" border=1 class='wikitable table_descrowdesccol' | ||
|+ Possible values | |+ Possible values | ||
! style="width: 50px; text-align: center; " | C | ! style="width: 50px; text-align: center; " | C | ||
Line 212: | Line 211: | ||
|} | |} | ||
=== | === <span id="ts"></span><span id="ra2"></span><span id="yr"></span>{{ts}}, {{fs}}, {{ra2}}, {{yr}} === | ||
The {{Tt|[Triggers]}} section in a map is a list of comma-separated strings that looks like this: | The {{Tt|[Triggers]}} section in a map is a list of comma-separated strings that looks like this: | ||
[Triggers] | [Triggers] | ||
ID=HOUSE,LINKED_TRIGGER,NAME, | ID=HOUSE,LINKED_TRIGGER,NAME,DISABLED,EASY,NORMAL,HARD,PERSISTENCE | ||
ID1=HOUSE,LINKED_TRIGGER,NAME, | ID1=HOUSE,LINKED_TRIGGER,NAME,DISABLED,EASY,NORMAL,HARD,PERSISTENCE | ||
etc. | etc. | ||
{| style="width: 90%" border=1 class="table_descrowdesccol" | {| style="width: 90%" border=1 class="wikitable table_descrowdesccol" | ||
|+ Meanings of each string | |+ Meanings of each string | ||
! style="width: 13em; " | String | ! style="width: 13em; " | String | ||
Line 233: | Line 232: | ||
|- | |- | ||
! {{Anchor|LINKED_TRIGGER|ts}} | ! {{Anchor|LINKED_TRIGGER|ts}} | ||
| A trigger that | | A trigger that uses the tag of this trigger, so you can add multiple triggers to a single object. | ||
|- | |- | ||
! {{Anchor|NAME|ts}} | ! {{Anchor|NAME|ts}} | ||
| A plain text string used as a name of this Trigger. Not used ingame, only in the map editor. Should not contain commas. | | A plain text string used as a name of this Trigger. Not used ingame, only in the map editor. Should not contain commas. | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|DISABLED|ts}} | ||
| Can be set to {{Tt|0}} ('disabled') or {{Tt|1}} (' | | Can be set to {{Tt|0}} ('not disabled') or {{Tt|1}} ('disabled') (Note the negation in this string). Specifies whether this trigger is disabled at the beginning of the game. If it is disabled, another trigger has to explicitly enable it via a special Action. | ||
|- | |- | ||
! {{Anchor|EASY|ts}} | ! {{Anchor|EASY|ts}} | ||
Line 250: | Line 249: | ||
| Can be set to {{Tt|0}} ('disabled') or {{Tt|1}} ('enabled'). Specifies whether this trigger is active in the Hard difficulty (It refers to the Campaign Difficulty slider or the Difficulty slider in the Options menu.) | | Can be set to {{Tt|0}} ('disabled') or {{Tt|1}} ('enabled'). Specifies whether this trigger is active in the Hard difficulty (It refers to the Campaign Difficulty slider or the Difficulty slider in the Options menu.) | ||
|- | |- | ||
! {{Anchor| | ! {{Anchor|PERSISTENCE|ts}} | ||
| Specifies whether this trigger is | | {{obsolete|{{ts}} to {{yr}}|trigger's persistence}} Specifies whether this trigger is persistent (see [[#td_PersistantType|PersistantType]] for more info). | ||
{| style="margin-left: 50px;" border=1 class='table_descrowdesccol' | {| style="margin-left: 50px;" border=1 class='wikitable table_descrowdesccol' | ||
|+ Possible values | |+ Possible values | ||
! style="width: 50px; text-align: center; " | Value | ! style="width: 50px; text-align: center; " | Value | ||
! Meaning | ! Meaning | ||
|- | |- | ||
! style="width: 50px; text-align: center; " | 0 | ! style="font-family: monospace; width: 50px; text-align: center; " | 0 | ||
| | | volatile | ||
|- | |- | ||
! style=" | ! style="font-family: monospace; width: 50px; text-align: center; " | 1 | ||
| persistent | |||
| | |||
|} | |} | ||
This appears to have been superseded by the persistence control in [[tags]]: In TS to YR, a trigger is associated with a tag, either by itself or through another trigger. The game uses the persistence mode specified in the trigger's associated tag entry. Accordingly, [[Final Sun]] and [[Final Alert 2]] map editors set the tag's persistence mode when the persistence value is modified from either Trigger or Tag dialogs. | |||
|} | |} | ||
[[Category: Maps Sections|Triggers]] | [[Category: Maps Sections|Triggers]] |
Latest revision as of 08:56, 31 January 2024
Map triggers are responsible for the special events happening in the map. For example, the singleplayer campaign maps have triggers to do things like "if unit x is destroyed, declare player the winner" or "if building y is still standing after twenty minutes, declare the player the loser". Without map triggers, scripting maps would be impossible.
The internal hierarchy works like this:
- A CellTag points to a Tag, and tells the game to consider its Trigger when processing events.
- A Tag points to a Trigger.
- A Trigger points to an Event and an Action, and tells the game "If my Events happen, execute my Actions".
- An Event lists the condition(s) that invoke this trigger, e.g. "45 seconds have passed".
- An Action lists the actions that should be performed by the game when this trigger fires. These are things like "Give the AI three nuclear silos", "Reveal the aforementioned silos to the player" or "Paradrop these desolators as a reinforcement for the player".
Section
Tiberian Dawn
The [Triggers] section in a map is a list of comma-separated strings that looks like this:
[Triggers] ID=EventType,ActionType,EventParameter,House,Team,PersistantType ID1=EventType,ActionType,EventParameter,House,Team,PersistantType
etc.
String | Meaning | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ID | This trigger's ID. | ||||||||||||
EventType | This trigger's Event (See Events). | ||||||||||||
ActionType | This trigger's Action (See Actions). | ||||||||||||
EventParameter | The parameter for the Event. | ||||||||||||
House | The name of the house associated with this trigger, or None. This house is used as a parameter by some Events and Actions. | ||||||||||||
Team | Associated teamtype ID, or None. | ||||||||||||
PersistantType[sic] |
Controls if and when the trigger should destroy itself after it goes off. Once destroyed, a trigger cannot be fired again.
|
Red Alert, Counterstrike, Aftermath
The section is called [Trigs] and again is a list of comma-separated strings that looks like this:
[Trigs] name=P,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3 name1=P,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3
etc.
String | Meaning | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
P[ersistant] | Specifies whether this trigger is persistent (see PersistantType for more info).
2 ↑ "switch" means activate this trigger | ||||||||||||||||||||||||||||||||
H[ouse] | The index of the house associated with this trigger. This house is used as a parameter by some Events and Actions. | ||||||||||||||||||||||||||||||||
C[ondition] |
Condition can be set to 0, 1, 2 or 3.
| ||||||||||||||||||||||||||||||||
A[ctivate] | |||||||||||||||||||||||||||||||||
E1 | Event 1's index (see Events). | ||||||||||||||||||||||||||||||||
E1P1 | Event 1's first parameter. | ||||||||||||||||||||||||||||||||
E1P2 | Event 1's second parameter. | ||||||||||||||||||||||||||||||||
E2 | Event 2's index. | ||||||||||||||||||||||||||||||||
E2P1 | Event 2's first parameter. | ||||||||||||||||||||||||||||||||
E2P2 | Event 2's second parameter. | ||||||||||||||||||||||||||||||||
A1 | Action 1's index (see Actions). | ||||||||||||||||||||||||||||||||
A1P1 | Action 1's first parameter. | ||||||||||||||||||||||||||||||||
A1P2 | Action 1's second parameter. | ||||||||||||||||||||||||||||||||
A1P3 | Action 1's third parameter. | ||||||||||||||||||||||||||||||||
A2 | Action 2's index. | ||||||||||||||||||||||||||||||||
A2P1 | Action 2's first parameter. | ||||||||||||||||||||||||||||||||
A2P2 | Action 2's second parameter. | ||||||||||||||||||||||||||||||||
A2P3 | Action 2's third parameter. |
Tiberian Sun, Firestorm, Red Alert 2, Yuri's Revenge
The [Triggers] section in a map is a list of comma-separated strings that looks like this:
[Triggers] ID=HOUSE,LINKED_TRIGGER,NAME,DISABLED,EASY,NORMAL,HARD,PERSISTENCE ID1=HOUSE,LINKED_TRIGGER,NAME,DISABLED,EASY,NORMAL,HARD,PERSISTENCE
etc.
String | Meaning | ||||||
---|---|---|---|---|---|---|---|
ID | The Trigger's ID. The game assumes the Actions and Events with the same ID belong to this Trigger automatically. | ||||||
HOUSE | The House associated with this trigger. This house is used as a parameter by some Events and Actions. | ||||||
LINKED_TRIGGER | A trigger that uses the tag of this trigger, so you can add multiple triggers to a single object. | ||||||
NAME | A plain text string used as a name of this Trigger. Not used ingame, only in the map editor. Should not contain commas. | ||||||
DISABLED | Can be set to 0 ('not disabled') or 1 ('disabled') (Note the negation in this string). Specifies whether this trigger is disabled at the beginning of the game. If it is disabled, another trigger has to explicitly enable it via a special Action. | ||||||
EASY | Can be set to 0 ('disabled') or 1 ('enabled'). Specifies whether this trigger is active in the Easy difficulty (It refers to the Campaign Difficulty slider or the Difficulty slider in the Options menu.) | ||||||
NORMAL | Can be set to 0 ('disabled') or 1 ('enabled'). Specifies whether this trigger is active in the Normal difficulty (It refers to the Campaign Difficulty slider or the Difficulty slider in the Options menu.) | ||||||
HARD | Can be set to 0 ('disabled') or 1 ('enabled'). Specifies whether this trigger is active in the Hard difficulty (It refers to the Campaign Difficulty slider or the Difficulty slider in the Options menu.) | ||||||
PERSISTENCE | Logic related to trigger's persistence, as a whole or in part, is obsolete in Tiberian Sun to Yuri's Revenge.
Specifies whether this trigger is persistent (see PersistantType for more info).
This appears to have been superseded by the persistence control in tags: In TS to YR, a trigger is associated with a tag, either by itself or through another trigger. The game uses the persistence mode specified in the trigger's associated tag entry. Accordingly, Final Sun and Final Alert 2 map editors set the tag's persistence mode when the persistence value is modified from either Trigger or Tag dialogs. |