Trying to solve the AI full stack spamming is driving me nuts. Trying to adjust the income\expense side so that there is only a small surplus is pretty much impossible due to the number of variables. If the AI has a dollar and he can buy a unit for that dollar then he will do it.
A very reliable method would be to test for the number of exisiting units and use a counter in the EDB. Drawback would be that every unit would need a separate recruit entry line for every faction it's available for (never mind the usual pit fall of EDB conditions) because the recruit poll is set to zero every time the condition is not met, so combined faction lines won't work.
There is no direct testing, eg FactionNumberUnits.
Testing how many units have been recruited is a matter of routine (although tedious).
Testing how many units got killed is not possible as far as I know or is there some battle related script stuff for it (NumEnemyUnitsKilled?)
Any other work around?