The trigger record
Triggers are stored in the map's TRIG section, one 2400-byte record per trigger, in the
order of the list. Mission briefings are in MBRF, in the same record with a different
set of actions.
A trigger#
| Bytes | Holds |
|---|---|
| 0–319 | 16 conditions, 20 bytes each |
| 320–2367 | 64 actions, 32 bytes each |
| 2368–2371 | the trigger's flags |
| 2372–2398 | 27 bytes, one per player or group: non-zero where the trigger runs for it |
| 2399 | used by the game while the trigger runs; 0 in a saved map |
The trigger's flags:
| Bit | Meaning |
|---|---|
| 0x04 | Preserved: the same as a Preserve Trigger action |
| 0x08 | Disabled: the trigger never runs |
| 0x02 | Ignore Defeat and Draw for this trigger |
| 0x01, 0x10, 0x20, 0x40 | used by the game while it runs; 0 in a saved map |
The list of conditions ends at the first slot whose type is 0, and so does the list of actions.
A condition#
| Bytes | Holds |
|---|---|
| 0–3 | Location number, counted from 1; 0 for none. |
| 4–7 | Player or group. |
| 8–11 | Amount compared against. |
| 12–13 | Unit type. |
| 14 | Comparison, or the switch state for Switch. |
| 15 | Which condition this is. |
| 16 | Resource type, score type or switch number, depending on the condition. |
| 17 | Flags: 0x02 disabled; the others are editor and game bookkeeping. |
| 18–19 | Unused by ordinary triggers; some EUD tools store a mask here. |
All numbers are little-endian. An unused condition slot is all zeros.
An action#
| Bytes | Holds |
|---|---|
| 0–3 | Location number, counted from 1; 0 for none. The source location where there are two. |
| 4–7 | String-table entry of the text. |
| 8–11 | String-table entry of the sound file's name. |
| 12–15 | A time: milliseconds, or seconds for Set Countdown Timer. |
| 16–19 | Player or group; the first player where there are two. |
| 20–23 | Second player, destination location, amount, properties slot or AI script, depending on the action. |
| 24–25 | Unit type, or the score, resource or alliance type. |
| 26 | Which action this is. |
| 27 | Unit count, modifier, switch action, order or state, depending on the action. |
| 28 | Flags: 0x02 disabled, 0x04 always display; the others are editor and game bookkeeping. |
| 29 | Unused. |
| 30–31 | Unused by ordinary triggers; some EUD tools store a mask here. |
All numbers are little-endian. An unused action slot is all zeros.