AI triggers
Defines the weighted records from which a house draws its next one or two teams.
- Kind
- Record
- File
AI.INI,AIFS.INI,map file- Section
[AITriggerTypes]- Record form
<AITrigger ID>=<up to 18 comma-separated fields>- Enable section
[AITriggerTypesEnable]
Fields
| # | Field | Accepted value | Required |
|---|---|---|---|
| 1 | Name | Display name | Yes |
| 2 | Primary team | TeamType ID or <none> | Yes |
| 3 | Owner | House ID, <all>, or <none>Tested only in a campaign game. A house ID the game does not recognize counts as <none>. | Yes |
| 4 | Ignored | Present but discarded | Yes |
| 5 | Condition type | Integer from -1 through 4 | Yes |
| 6 | Condition object | ObjectType ID | Yes |
| 7 | Comparator | Hexadecimal comparison block | Yes |
| 8 | Starting weight | Number truncated to an integer | No |
| 9 | Minimum weight | Number truncated to an integer | No |
| 10 | Maximum weight | Number truncated to an integer | No |
| 11 | Skirmish | 0 or 1 | No |
| 12 | Ignored | Present but discarded | No |
| 13 | Side | The side's position in the rules' [Sides] list, counted from one; 0 leaves the trigger unrestricted | No |
| 14 | Base defense | 0 or 1Stored and written back, never read; whether a trigger counts as defensive comes from its teams' IsBaseDefense. | No |
| 15 | Secondary team | TeamType ID or <none> | No |
| 16 | Easy | 0 or 1 | No |
| 17 | Medium | 0 or 1 | No |
| 18 | Hard | 0 or 1 | No |
Each assignment in [AITriggerTypes] defines one AI trigger: its ID to the left of =, and its fields, separated by commas, to the right. AI triggers and team production explains how a house chooses among triggers and what each field decides.
Where triggers are read
Section titled “Where triggers are read”The game reads AI triggers from AI.INI, then from AIFS.INI when Firestorm is enabled, then from the map.
Whether a trigger is enabled depends on where it was defined:
- A trigger from
AI.INIorAIFS.INIis enabled. - A trigger from the map is disabled unless the map’s
[AITriggerTypesEnable]section enables it.
[AITriggerTypesEnable] pairs an AI trigger ID with a yes-or-no value. In a campaign game, yes enables the trigger and no disables it, and this works for a trigger from AI.INI or AIFS.INI as well. Outside a campaign, every ID listed in the section is enabled, whatever its value.
A map entry with the same ID as a trigger from AI.INI or AIFS.INI redefines that trigger. Each field the map entry supplies replaces the earlier value. The trigger stays enabled unless [AITriggerTypesEnable] disables it, and it counts as a map trigger, so IgnoreGlobalAITriggers=yes does not skip it.
Writing the fields
Section titled “Writing the fields”Put a value in every field up to the last one you write. Consecutive commas count as one separator, so an empty field moves every later field one position earlier. Write <none> in a team or owner field you want to leave empty, and the intended value in every other field. A 0 in a weight field sets that weight to 0, and a 0 in a difficulty field turns the trigger off at that difficulty.
Fields 1 through 7 are required. If the value ends before field 7, the trigger is still registered with the fields read so far. A new trigger cut short after its owner and before its condition type has no condition, so a campaign game can still draw it. A redefined trigger cut short there keeps its earlier condition.
Fields 8 through 18 can be left off the end. A new trigger missing them has weights of 1, is not available in skirmish, has no side restriction and no secondary team, and is enabled at every difficulty. A redefined trigger keeps the values it already had.
Condition types
Section titled “Condition types”The condition type selects what the trigger measures and which of the next two fields it reads. A field the condition does not read can hold anything.
| Value | What it measures | Fields it reads |
|---|---|---|
-1 | Nothing; the condition always holds | Neither |
0 | How many objects of the condition object’s type the enemy owns | Condition object and comparison block |
1 | How many objects of the condition object’s type the owning house owns | Condition object and comparison block |
2 | Whether the enemy’s power output minus its drain is below 100 | Neither |
3 | Whether the enemy’s power output minus its drain is below 0 | Neither |
4 | The enemy’s money, counting stored Tiberium | Comparison block |
A condition type outside this table never holds. AI triggers and team production covers which house is the enemy and what happens when a house has none.
The comparison block
Section titled “The comparison block”The comparison block holds the number to compare against and the comparison to apply. It is written in hexadecimal, two digits to a byte:
- bytes 1 to 4 hold the number;
- bytes 5 to 8 hold the comparison, as a value from the table below.
Each is a four-byte integer written low byte first. Digits after the sixteenth are not used.
| Comparison value | Holds when the measured amount is |
|---|---|
0 | Less than the number |
1 | Less than or equal to the number |
2 | Equal to the number |
3 | Greater than or equal to the number |
4 | Greater than the number |
5 | Not equal to the number |
Any other comparison value never holds. For example, “at least 5” is the number 5 with comparison 3, so the block starts 0500000003000000.
The condition object
Section titled “The condition object”The condition object is an ObjectType ID. The game looks it up among infantry, vehicle, aircraft and structure types, in that order, and uses the first match. An ID that matches no type does not reject the trigger: the count is 0, and the comparison is made against that.
Accepted settings
1 of 1
| Key | Description | Value | When omitted |
|---|---|---|---|
Name[<ObjectType ID>] | The display name of a type definition, a scenario, a multiplayer map, or a music track. | string | the type's section name |
No keys match the current filters.
Source files
Linked at revision 51b52aa38392.
History
- Changed0.2.0In development