Editing Unit Flavors

M0RF34S

Chieftain
Joined
Nov 17, 2024
Messages
7
Hey, in trying to fix the AI's anti-air/carrier spam, I decided to edit their flavors. Is the following code correct? Mostly asking because I'm unsure of when I'm supposed to use "XXXXType" (in this case UnitType) vs just "Type". Thanks!

<Unit_Flavors>
<Update>
<Where UnitType="UNIT_ANTI_AIRCRAFT_GUN" FlavorType="FLAVOR_ANTIAIR"/>
<Set Flavor="6"/>
</Update>
</Unit_Flavors>
 
Last edited:
I think it depends on the table. You're uppdating Unit_Flavors, which has a column 'UnitType', but no 'Type'

1753009882334.png


you'll only use 'Type' when directly accessing the Units table

1753009967074.png
 
The anti-air spam is due to some dodgy maths in the (unmodded) DLL that applies promotion bonuses to all forms of attack and not just to those limited by the domain (so the AA guns are being boosted up the list of good land units to build because of their bonuses against air units). From the testing I did many years ago, changing the flavour values will have no effect on the AI's love of anti-air units as they are land units and therefore count as a valid option when the AI is looking to boost its land attack/defence units.
 
The anti-air spam is due to some dodgy maths in the (unmodded) DLL that applies promotion bonuses to all forms of attack and not just to those limited by the domain (so the AA guns are being boosted up the list of good land units to build because of their bonuses against air units). From the testing I did many years ago, changing the flavour values will have no effect on the AI's love of anti-air units as they are land units and therefore count as a valid option when the AI is looking to boost its land attack/defence units.
would setting FLAVOR_ANTIAIR to 0 for all leaders in Leader_Flavors (and setting the flavor randomiser in GlobalDefines to 0) work?
Spoiler :

1753019785231.png

 
IIRC the problem is not with the AI wanting to build anti-air units, but with the AI building anti-air units as offensive/defensive land units because the "unit power" maths is broken and makes them look like super-powerful general-purpose units.

EDIT: This is my original spreadsheet.
Col A is the unit name
Col B is the "unit power" using the broken unmodded DLL code
Col C is the "unit power" fixing the bad maths, but leaving the broken logic around domain based promotions
Col D is the difference between B and C
Col E is the "unit power" fixing the broken logic around domain based promotions (ie a unit should only receive boosts to its power for promotions that operate in its operational domain)
Col F is the difference between B and E
Col G is the "unit power" when restricting anti-air unit to be only defensive (and not offensive) units
Col H is the difference between B and G

From the spreadsheet you can see just how badly the broken maths alone affects the AA units' power score. Which is why the AI builds them as offensive/defensive land units, regardless of whether it actually needs AA units. They are better than everything except Mech Inf, so the AI will never build Infantry once the AA Gun is available, and once the Mobile SAM is available, it'll stop building Mech Inf.
 

Attachments

Last edited:
Back
Top Bottom