[AI] AI functions and variables

I’m looking at the AI functions like PlayersMilitary_Fighter() and PlayersUnitTypeCount(). What parameters can they take? There are several global variables but I don’t understand when to use them and when not to. For instance, which of the following variables can the PlayersMilitary_Fighter() and PlayersUnitTypeCount() functions take? And what do their values mean?


I am trying to get the AI to think about the other CPU players instead of just itself. For instance, instead of this:

local AFiValue = PlayersMilitary_AntiFighter(enemyIndex, player_max)
local ACoValue = PlayersMilitary_AntiCorvette(enemyIndex, player_max)
local AFrValue = PlayersMilitary_AntiFrigate(enemyIndex, player_max)

I am attempting this:

local AFiValue = PlayersMilitary_AntiFighter(player_enemy, player_total)
local ACoValue = PlayersMilitary_AntiCorvette(player_enemy, player_total)
local AFrValue = PlayersMilitary_AntiFrigate(player_enemy, player_total)

But I’m not sure I’m doing it properly. I’m not sure these variables are interchangeable.

This is in order to get the AI to work with my DEFINED ROLES mod, where every player is in charge of a different technology: Capital/Production, Frigate/Platform, Fighter/Corvette.

I suppose instead of doing all the above, I could just use one CPU player for the opposing team. But, I would then need a per-player starting fleet with three players’ worth of ships, and per-player unitcaps that are extra large. I don’t think this last one is possible.