ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Triggers

From ModEnc
Revision as of 23:13, 30 July 2013 by RP (talk | contribs)
Jump to: navigation, search
This page should correctly be named "[Triggers]"; it is wrong due to technical restrictions.


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 this 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 aforealludedto 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=EVENT,ACTION,EVENT_PARAMETER,HOUSE,ASSOCIATED_TEAMTYPE,REPEATING
ID1=EVENT,ACTION,EVENT_PARAMETER,HOUSE,ASSOCIATED_TEAMTYPE,REPEATING

etc.

Meanings of each string
String Meaning
ID This trigger's ID.
EVENT This trigger's Event (See Events).
ACTION This trigger's Action (See Actions).
EVENT_PARAMETER 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.
ASSOCIATED_TEAMTYPE Associated teamtype ID, or None.
REPEATING

Specifies whether this trigger is repeating (see The Repeating puzzle for more info).

Possible values
Value Meaning CCMAP description
0 single-shot Loop : no
1 repeating a (fire when all attached objects have fired) Loop : and (1)
2 repeating b (fire when any attached object has fired) Loop : or (2)

Red Alert, Counterstrike, Aftermath

The section is called [Trigs] and again is a list of comma-separated strings that looks like this:


[Trigs]
name=R,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3
name1=R,H,C,A,E1,E1P1,E1P2,E2,E2P1,E2P2,A1,A1P1,A1P2,A1P3,A2,A2P1,A2P2,A2P3

etc.

Meanings of each string
String Meaning
R[epeating] Specifies whether this trigger is repeating (see The Repeating puzzle for more info).
Possible values
Value Meaning RAED description
0 single-shot a temporary (any linked event => switch1, destroy)
1 single-shot b 1 (fire when all attached objects have fired) semi-constant (all linked events => switch, destroy)
2 repeating (fire when any attached object has fired) constant (any linked event => switch)

1 "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.
Activate can be set to 0 or 1 , and essentially says whether this trigger has or doesn't have a second action defined.
These two flags define which event fires which action:

Possible values
C A What happens RAED phrasing
0 0 (Event 1) fires Action 1 simple([event1 => action1 [+ action 2]])
0 1 (Event 1) fires Actions 1 and 2
1 0 (Event 1 and Event 2) fires Action 1 and([event1 && event2 => action1 [+action 2]])
1 1 (Event 1 and Event 2) fire Actions 1 and 2
2 0 (Event 1 or Event 2) fires Action 1 or([event1 | | event2 => action1 [+action 2]])
2 1 (Event 1 or Event 2) fire Actions 1 and 2
3 0 Event 1 fires Action 1 (?) complex ([event1 => action1; event 2 => action2])
3 1 Event 1 fires Action 1; Event 2 independently fires Action 2
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,REPEATING
ID1=HOUSE,LINKED_TRIGGER,NAME,DISABLED,EASY,NORMAL,HARD,REPEATING

etc.

Meanings of each string
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 is fired automatically when this trigger fires, or <none> if no additional triggers should fire.
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.)
REPEATING Specifies whether this trigger is repeating (see The Repeating puzzle for more info).
Possible values
Value Meaning
0 single-shot
1 unknown
2 repeating (fire when any attached object has fired)

Considerations

The Repeating puzzle

This needs testing
Cc mouse.png
The following section contains information that has not been personally confirmed by the revision's author; readers are encouraged to test it themselves and update the section accordingly.

As you may have noticed, different games specify different values for the Repeating flag: TD says R=1 means the trigger will repeat, RA says it will not, and TS-YR don't document this at all. This needs more testing.