<Condition name="Count Units in Area Around Army">
<Param name="SrcArmy" dispName="$$22348$$Army" VarType="group">default</Param>
<Param name="Player" dispName="$$22301$$Player" VarType="player">1</Param>
<Param name="Dist" dispName="QV Radius" VarType="string">healingradius</Param>
<Param name="Count" dispName="QV Count" VarType="string">healingcount</Param>
<Command>static int constUnitTypeUnit = -1;</Command>
<Command>if (constUnitTypeUnit == -1) {</Command>
<Command>constUnitTypeUnit = 500;</Command>
<Command>while (kbGetUnitTypeName(constUnitTypeUnit) != "Unit") { constUnitTypeUnit++; }</Command>
<Command>}</Command>
<Command>int results = 0;</Command>
<Command>int oldcontext = xsGetContextPlayer();</Command>
<Command>xsSetContextPlayer(%Player%);</Command>
<Command>int query = kbUnitQueryCreate("SomeTriggerQuery");</Command>
<Command>kbLookAtAllUnitsOnMap();</Command>
<Command>trUnitSelectClear();</Command>
<Command>trArmySelect("%SrcArmy%");</Command>
<Command>vector armypos = kbUnitGetPosition(trGetSelectedUnitID(0));</Command>
<Command>for(i=12;>=1)</Command>
<Command>{</Command>
<Command>if (i == %Player% || kbIsPlayerAlly(i))</Command>
<Command>{</Command>
<Command>continue;</Command>
<Command>}</Command>
<Command>kbUnitQuerySetPlayerID(query, i);</Command>
<Command>kbUnitQuerySetPosition(query, armypos);</Command>
<Command>kbUnitQuerySetMaximumDistance(query, trQuestVarGet("%Dist%"));</Command>
<Command>kbUnitQuerySetState(query, cUnitStateAlive);</Command>
<Command>kbUnitQuerySetUnitType(query, constUnitTypeUnit);</Command>
<Command>results = results + kbUnitQueryExecute(query);</Command>
<Command>if (results > trQuestVarGet("%Count%"))</Command>
<Command>{</Command>
<Command>break;</Command>
<Command>}</Command>
<Command>}</Command>
<Command>bool out = (trQuestVarGet("%Count%") == results);</Command>
<Command>kbUnitQueryDestroy(query);</Command>
<Command>xsSetContextPlayer(oldcontext);</Command>
<Expression>out</Expression>
</Condition>
So thank you to Loggy for working with me and showing/teaching me a lot about AOM:EE and its querky code. You're especially patient.
Thank you as well to nottud on reddit and Azerath on Steam.
How the trigger works:
Unlike Count Units in Area, this triggers "player" selector is needed for the army so whatever player owns the army, put that player in the player selector.
This trigger then looks in a radius around that army and returns true if there are no units in the area.
You can modify the trigger how you want, but this was created for my specific use case for my upcoming scenario.
Enjoy!