Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Customizable Multiple AI Conditions

Open handama opened this issue 3 years ago • 0 comments

AI Triggers

Customizable Multiple AI Conditions

  • AI Triggers can now have multiple conditions.

    • The conditions are divided into 2 parts, essential requirements and optional requirements. All the essential requirements are required to be achieved, while only a given number of optional requirements are needed.
  • In an AITriggerType in aimd.ini, its ConditionType must be set to -1, and ComparisonObject must be set to <none>. Comparator should be filled with 0 except for last 8 characters. Eighth to fifth from the bottom(xxxx) should be 0001 to enable this feature, and last 4 characters(yyyy) should be an index number from AIConditionsList in rulesmd.ini. Notice: xxxx and yyyy are both decimal integers.

In aimd.ini:

[AITriggerTypes]
ExampleAITrigger=Name,Team1,OwnerHouse,TechLevel,-1,<none>,00000000000000000000000000000000000000000000000000000000xxxxyyyy,StartingWeight,MinimumWeight,MaximumWeight,IsForSkirmish,unused,Side,IsBaseDefense,Team2,EnabledInE,EnabledInM,EnabledInH
  • An AICondition has multiple sections, and they are divided by /. The first part are two integers, defining the number of essential requirements and optional requirements. The rest parts have the same format: PickMode,CompareMode,Number,TechnoType. They define each requirement. The first few parts covered by the number of essential requirements are regarded as essential requirements, and the rest of them are regarded as optional requirements.

In rulesmd.ini:

[AIConditionsList] ;zero-based index
0=NumberOfEssentialRequirements,NumberOfOptionalRequirements/PickMode,CompareMode,Number,TechnoType/PickMode,CompareMode,Number,TechnoType......
;...

Available Pick Modes are:

Mode Description
0 pick enemies(except for neutral)
1 pick allies(except for neutral)
2 pick self
3 pick all(except for neutral)
4 pick enemy human players
5 pick allied human players
6 pick all human players
7 pick enemy computer players(except for neutral)
8 pick allied computer players(except for neutral)
9 pick all computer players(except for neutral)
10 pick neutral
11 pick all(including neutral)

Available Compare Modes are:

Mode Description
0 (count TechnoTypes)<
1 (count TechnoTypes)<=
2 (count TechnoTypes)==
3 (count TechnoTypes)>=
4 (count TechnoTypes)>
5 (count TechnoTypes)!=
6 Power Green
7 Power Yellow
8 Power Red
9 (count Money)<
10 (count Money)<=
11 (count Money)==
12 (count Money)>=
13 (count Money)>
14 (count Money)!=
15 Iron Curtain meets the percentage in AIMinorSuperReadyPercent
16 Chrono Sphere meets the percentage in AIMinorSuperReadyPercent
17 Iron Curtain doesn't meet the percentage in AIMinorSuperReadyPercent
18 Chrono Sphere doesn't meet the percentage in AIMinorSuperReadyPercent
  • When CompareMode is between 6-18, TechnoType should be <none>. When CompareMode is between 6-8, 15-18, Number should be 0.

Here is an example:

1=2,2/2,3,1,NATECH/0,8,0,<none>/0,3,5,SREF/0,3,3,BFRT/0,3,8,MGTK/0,3,12,MTNK
  • This means AI itself must has 1 or more NATECH, its enemy must has low power, and least 2 of 4 optional requirements are needed: its enemies have more than 5 SREFs, 3 BFRTs, 8 MGTKs, 12 MTNKs.

handama avatar Jul 09 '22 18:07 handama