RoeConditionSet C# file
HOSTED - T or F
UNITS - T or F looking for unit number of if true
PEFF - looking for percentage/number
LEVEL - ground/air/overflight/submerged
DMG - looking for number
RANGE --> child process within range, FRANGE is prolly not a main process - meaning true or false will do nothing unless - under Range queries.
DIST - looking for number
TYPE - looking for unit type like BB
PLAYER - Neutral, computer or player
--------------------------------------------------------
SAI_UT_CITY_RETAKE - units which can retake cities (when there are none owned)
[SAI_UT_CITY_RETAKE][IN][AR][EN][BA][I7][I8][IG][IR][IS][P4][N8][GE]
The General and other units are placed here so when all his cities have been captured he will attempt to capture any city.
-------------------------------------------------------
[ ] Array set
( ) Conditional set
[SAI_ROE] Rules Of Engagement
[SAI_ROE_PRI] priority setting for encountering a type
[SAI_ROE_DEF] default setting when conditions don't apply
[GE] General unit
(GE) greater than or equal to
(A) and All conditions must be true in order to work.
(O) or Any condition must be true in order to work.
(T) true
(F) false
-------------------------------------------------------------------
(TYPE)(EQ)(TR) Unit is transport
(PLY)(EQ)(MAN) Human player
(PLY)(EQ)(COMP) Computer player
(UNIT)(EQ)(T) The unit is transporting another unit .
(HOST)(EQ)(T) The unit is transported by another unit .
(DIS)(EQ)(1) The unit is 1 space away.
(DIS)(GT)(7) The unit is 8 spaces away.
-----------------------------------------------------------------
The below conditions depend on the fifo principal.
First in first out.
So place your conditions in an order that will give you optimum performance from the AI.
Once your sets of conditions are processed it will exit out on the priority set of conditions based on your logic.
Meaning if you want a sea or land or air transport considered first target then make it one of your preliminary lines.
It's best to get (LVL) out of the way first, then get all your [NA] doesn't apply to the General unit out of the way and followed by [EV] Evade a battleship for instance.
By doing this you will quickly process out any units that the General cannot impact, units the General cannot be impacted by and Units too powerful that can harm the General.
Now this is the point of the script you want the AI to think like a human and attack priority targets.
----------------------------------------------------------------
[SAI_ROE][GE][(A)(LVL)(NE)(OF)(LVL)(NE)(GR)][NA]
The above means: Air and Ground units to be only considered.
[SAI_ROE][GE][(A)(DIS)(GT)(1)][NA]
If the distance of the enemy unit being processed is greater than 1 space to the General unit - ignore and move to next condition.
[SAI_ROE][GE][(O)(TYPE)(EQ)(T6)](TYPE)(EQ)(TR)(TYPE)(EQ)(T8)(TYPE)(EQ)(T9)][NA]
If any of the sea transports are processed ignore them.
[SAI_ROE][GE][(O)(TYPE)(EQ)(FI)(TYPE)(EQ)(BO)(TYPE)(EQ)(F8)(TYPE)(EQ)(F4)(TYPE)(EQ)(F1)][EV]
If any attack aircraft are processed avoid and do not engage them.
[SAI_ROE][GE][(A)(TYPE)(EQ)(TK)(PLY)(EQ)(MAN)(TYPE)(EQ)(TK)(UNIT)(EQ)(T)(TYPE)(EQ)(TK)(DIS)(EQ)(1)][ME]
If unit is Truck & is human player & The truck is at least transporting 1 unit & is 1 space away then Melee attack it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(TK)(PLY)(EQ)(MAN)(TYPE)(EQ)(TK)(UNIT)(EQ)(F)(TYPE)(EQ)(TK)(DIS)(EQ)(1)][FE]
If unit is Truck & is human player & The truck is not transporting any units & is 1 space away then Fire at it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(TK)(PLY)(EQ)(COMP)(TYPE)(EQ)(TK)(UNIT)(EQ)(T)(TYPE)(EQ)(TK)(DIS)(EQ)(1)][ME]
If unit is Truck & is computer player & The truck is at least transporting 1 unit & is 1 space away then Melee attack it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(TK)(PLY)(EQ)(COMP)(TYPE)(EQ)(TK)(UNIT)(EQ)(F)(TYPE)(EQ)(TK)(DIS)(EQ)(1)][FE]
If unit is Truck & is computer player & The truck is not transporting any units & is 1 space away then Fire at it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(IN)(PLY)(EQ)(MAN)(TYPE)(EQ)(IN)(DIS)(EQ)(1)][FE]
If unit is Infantry & is human player & is 1 space away then Fire at it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(IN)(PLY)(EQ)(COMP)(TYPE)(EQ)(IN)(DIS)(EQ)(1)][FE]
If unit is Infantry & is computer player & is 1 space away then Fire at it.
[SAI_ROE_PRI][GE][IN][50]
I think this means if 50 spaces away seek it out.
[SAI_ROE_DEF][GE][EV]
If the condition finally gets to this line, the General will try to evade contact.
----------------------------------------------------------------------------------------------------
Example of logic order:
My first priority for the General unit in this particular AI script for the WW2 mod is an Armored car, carrying a unit. This is because it moves fast and could be carrying a recon infantry unit or General.
[SAI_ROE][GE][(A)(TYPE)(EQ)(A1)(PLY)(EQ)(MAN)(TYPE)(EQ)(A1)(UNIT)(EQ)(T)(TYPE)(EQ)(A1)(DIS)(EQ)(1)][ME]
So then the AI will focus primary priority on this especially if a human controls it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(A1)(PLY)(EQ)(COMP)(TYPE)(EQ)(A1)(UNIT)(EQ)(T)(TYPE)(EQ)(A1)(DIS)(EQ)(1)][ME]
Second priority is loaded armored car if computer controls it.
[SAI_ROE][GE][(A)(TYPE)(EQ)(A1)(PLY)(EQ)(MAN)(TYPE)(EQ)(A1)(UNIT)(EQ)(F)(TYPE)(EQ)(A1)(DIS)(EQ)(1)][FE]
Third priority is an unloaded armored car controlled by a human.
[SAI_ROE][GE][(A)(TYPE)(EQ)(A1)(PLY)(EQ)(COMP)(TYPE)(EQ)(A1)(UNIT)(EQ)(F)(TYPE)(EQ)(A1)(DIS)(EQ)(1)][FE]
and the last priority set for armored car is empty and controlled by computer.
(There is no correct order as many different strategies can apply and and Armored car may not be the first priority within another AI script. Remember this only applies to the General and not all other units within this particular AI script. (Those other units are not shown to keep simplicity to a minimum.))