# Tactical AI Filter - Run

Grammar — Create a new unit group by running filter on candidates
FlagsNative | Function

Use a tactical AI filter to trim a unit group and return a new one.

# Arguments

  • aifilter — Filter
  • unitgroup — Candidates

Returns — unitgroup

native unitgroup AIGetFilterGroup(
	aifilter filter,
	unitgroup group,
);

Category: AI Advanced / Filters / Functions

# Examples

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:246

    AISetFilterLifePerMarker(filter, damage*0.5, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:442

    AISetFilterLifePerMarker(filter, damage, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:533

    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridFAoEStunMin) {

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:564

    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);

    candidateGroup = AIGetFilterGroup(filter, scanGroup);
    if (candidateGroup == null) {
        return null;

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:617

    airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_GravitonPrison, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:672

        
        //  Get the group with all buildings first in case the hostile building group has none.
        nonHostileBuildings = AIGetFilterGroup(filter, scanGroup);

        airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_PlasmaBlast, c_fieldRange0), c_planeAir, c_unitAllianceAlly);

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:677

        AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    }
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup != null) {
        returnOrd = AIUnitGroupGetValidOrder(enemyGroup, ord, aiUnit, c_backwards);

campaigns/liberty.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:722

    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (AIIsCampaign(player) && UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridCShockWaveMin) {

campaigns/liberty.sc2campaignbase.sc2maps/maps/campaign/ttosh03a.sc2map/MapScript.galaxy:469

    AISetFilterRange(lv_snipeFilter, lp_ghost, (StringToFixed(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "Range[" + IntToString(0) + "]", lp_owner)) + 1.0));
    AISetFilterLifePerMarker(lv_snipeFilter, StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "SnipeDamage", "Amount", lp_owner)), lv_snipeMarker);
    lp_candidates = AIGetFilterGroup(lv_snipeFilter, lp_candidates);
    lv_snipeOrder = OrderTargetingUnit(AbilityCommand("Snipe", 0), UnitGroupUnit(lp_candidates, 1));
    if ((UnitOrderIsValid(lp_ghost, lv_snipeOrder) == true)) {

campaigns/liberty.sc2campaign/base.sc2maps/maps/campaign/ttosh03a.sc2mapMapScript.galaxy:469

    AISetFilterRange(lv_snipeFilter, lp_ghost, (StringToFixed(CatalogFieldValueGet(c_gameCatalogAbil, "Snipe", "Range[" + IntToString(0) + "]", lp_owner)) + 1.0));
    AISetFilterLifePerMarker(lv_snipeFilter, StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "SnipeDamage", "Amount", lp_owner)), lv_snipeMarker);
    lp_candidates = AIGetFilterGroup(lv_snipeFilter, lp_candidates);
    lv_snipeOrder = OrderTargetingUnit(AbilityCommand("Snipe", 0), UnitGroupUnit(lp_candidates, 1));
    if ((UnitOrderIsValid(lp_ghost, lv_snipeOrder) == true)) {

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:246

    AISetFilterLifePerMarker(filter, damage*0.5, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:442

    AISetFilterLifePerMarker(filter, damage, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:533

    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridFAoEStunMin) {

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:564

    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);

    candidateGroup = AIGetFilterGroup(filter, scanGroup);
    if (candidateGroup == null) {
        return null;

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:617

    airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_GravitonPrison, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:672

        
        //  Get the group with all buildings first in case the hostile building group has none.
        nonHostileBuildings = AIGetFilterGroup(filter, scanGroup);

        airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_PlasmaBlast, c_fieldRange0), c_planeAir, c_unitAllianceAlly);

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:677

        AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    }
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup != null) {
        returnOrd = AIUnitGroupGetValidOrder(enemyGroup, ord, aiUnit, c_backwards);

campaigns/swarm.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:722

    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (AIIsCampaign(player) && UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridCShockWaveMin) {

campaigns/void.sc2campaignbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:847

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);

    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:52

    AISetFilterPlane(filterAI, c_planeGround);
    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);

    // Is there a threat in the area

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:63

    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

    // Setup a friendly filter

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:131

        filterAI = AIFilter(player);
        AISetFilterMelee(filterAI, c_onlyRanged);
        rangeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

        // see if there is a large group nearby to split

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:514

        AISetFilterInCombat(filter, c_onlyInCombat);
        AISetFilterRange(filter, unitToCheck, nearbyRange);
        nearbyEnemies = AIGetFilterGroup(filter, scanGroup);
        numEnemies = UnitGroupCount(nearbyEnemies, c_unitCountAll);
        if (numEnemies < minEnemies) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:567

    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);
    AISetFilterBehaviorCount(filterAI, c_noBehaviorMin, c_noBehaviorMax, c_BF_TemporalField);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, scanGroup);

    // see if there is a large enough group nearby

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:817


    //  Pick a valid target
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1085

    AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, chrono, c_fieldTargetFiltersAB)));
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_TimeWarp);
    prodGroup = AIGetFilterGroup (filter, prodGroup);
    if (prodGroup == null) {
        return;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1193

    filterAI = AIFilter(player);
    AISetFilterPlane(filterAI, c_planeGround);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);
    groundCount = UnitGroupCount(groundEnemies, c_unitCountAlive);

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1223

    filterAI = AIFilter(player);
    AISetFilterPlane(filterAI, c_planeGround);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);

    if (UnitGroupCount(groundEnemies, c_unitCountAlive) > 0) {

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1569

    AISetFilterLifeSortReference(filter, c_aiDisintegrationDamage, c_aiDisintegrationDamage*c_distanceFromDamage); 

    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:66

    //  Select starting from the end, which is the target that has health closest to the cannon's damage
    //
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:223

    //  damage.
    //
    targetGroup = AIGetFilterGroup(filterAI, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:283

    //  damage.
    //
    targetGroup = AIGetFilterGroup(filterAI, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:463

    AISetFilterLifePerMarker(filter, damage, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:877

                    AISetFilterMelee(filter, c_onlyRanged);
                    AISetFilterValidPassenger(filter, aiUnit);
                    nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);
                }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:910

            AISetFilterMelee(filter, c_onlyRanged);
            AISetFilterValidPassenger(filter, aiUnit);
            nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);
        }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1170

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterSelf(filter, aiUnit);
    targetGroup = AIGetFilterGroup(filter, targetGroup);

    scanCount = UnitGroupCount(targetGroup, c_unitCountAll);

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1190

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterSelf(filter, aiUnit);
    targetGroup = AIGetFilterGroup(filter, targetGroup);

    scanCount = UnitGroupCount(targetGroup, c_unitCountAll);

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1242

    //  damage.
    //
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1654

    AISetFilterLifeSortReference(filter, c_minLockOnDamage, c_minLockOnDamage*c_distanceFromDamage);

    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null || UnitGroupCount(targetGroup, c_unitCountAll) == 0) {
        return;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:36

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterLifeLost(filter, AIEffectFixed(player, c_EF_Transfusion, c_fieldEffectChange0) - 20, c_noMax);
    group = AIGetFilterGroup(filter, group);
    if (group == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:220

    AISetFilterPlane(filter, c_planeGround);
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperCloudBuff);
    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:312

    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperParasiticBomb);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    airGroup = AIGetFilterGroup(filter, scanGroup);
    
    loc = AIBestTargetPoint(

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:481

    AISetFilterAlliance(groundAirFilter, c_playerGroupEnemy);
    AISetFilterPlane(groundAirFilter, c_planeGround);
    enemyGroundCount = UnitGroupCount(AIGetFilterGroup(groundAirFilter, scanGroup), c_unitCountAlive);

    AISetFilterPlane(groundAirFilter, c_planeAir);

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:484


    AISetFilterPlane(groundAirFilter, c_planeAir);
    enemyAirCount = UnitGroupCount(AIGetFilterGroup(groundAirFilter, scanGroup), c_unitCountAlive);

    //  Apply filters to enemies

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:495

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterCanAttackEnemy(filter, enemyGroundCount, enemyAirCount);
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:504

    filter = AIFilter(player);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, gameMark);
    targetGroup = AIGetFilterGroup(filter, targetGroup);
    if (targetGroup == null) {
        return null;

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:535

    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_FungalGrowth);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, gameMark);
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:599

    AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_InfestedTerrans, c_fieldRange0) + 1);
    AISetFilterLife(filter, c_noMin, c_noMax);
    targetGroup = AIGetFilterGroup(filter, scanGroup);

    //  Check for valid target

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:931

    AISetFilterPlane(filter, c_planeGround);
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, false);
    enemyGroundCount = UnitGroupCount(AIGetFilterGroup(filter, scanGroup), c_unitCountAlive);

    if (enemyGroundCount > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:1985

    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    AISetFilterBits(lv_enemyNearbyFilter, UnitFilter((1 << c_targetFilterVisible), 0, (1 << c_targetFilterAir) | (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile) | (1 << c_targetFilterBuried), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterInvulnerable - 32))));
    lv_enemyUnitsNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if (((UnitGroupCount(lv_enemyUnitsNearby, c_unitCountAlive) <= 0) || (UnitOrderIsValid(lp_aIUnit, Order(AbilityCommand("MutatorAmonRaynorSnipe", 0))) == false) || (UnitAbilityGetCooldown(lp_aIUnit, "MutatorAmonRaynorSnipe", "Abil/MutatorAmonRaynorSnipe") > 0.0) || (UnitOrderHasAbil(lp_aIUnit, "MutatorAmonRaynorSnipe") == true))) {
        return ;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2021

    // Implementation
    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if ((UnitGetCooldown(lp_aIUnit, "MutatorAmonDehakaHeal") <= 0.0) && ((UnitGetPropertyFixed(lp_aIUnit, c_unitPropLifeMax, c_unitPropCurrent) - UnitGetPropertyFixed(lp_aIUnit, c_unitPropLife, c_unitPropCurrent)) > 150.0)) {
        libNtve_gf_AICast(lp_aIUnit, Order(AbilityCommand("MutatorAmonDehakaHeal", 0)));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2042

        AISetFilterRange(lv_canidatesFilter, lp_aIUnit, lv_abilityRange);
        AISetFilterLifeSortReference(lv_canidatesFilter, 100.0, 50);
        lv_canidates = AIGetFilterGroup(lv_canidatesFilter, lp_nearByUnits);
        libNtve_gf_AICast(lp_aIUnit, OrderTargetingUnit(AbilityCommand("MutatorAmonDehakaDrag", 0), UnitGroupUnit(lv_canidates, UnitGroupCount(lv_canidates, c_unitCountAlive))));
        return ;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2103

    // Implementation
    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if ((UnitGroupCount(lp_nearByUnits, c_unitCountAlive) <= 0)) {
        return ;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2138

        AISetFilterRange(lv_targetFilter2, lp_aIUnit, lv_abilityRange);
        AISetFilterLifeSortReference(lv_targetFilter2, lv_abilityDamage, (lv_abilityDamage * 0.2));
        lv_canidates = AIGetFilterGroup(lv_targetFilter2, lp_nearByUnits);
        libNtve_gf_AICast(lp_aIUnit, OrderTargetingUnit(AbilityCommand("MutatorAmonNovaWeaponImprovedCanisterRifleSnipe", 0), UnitGroupUnit(lv_canidates, UnitGroupCount(lv_canidates, c_unitCountAlive))));
        return ;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2178

    // Implementation
    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if ((UnitGroupCount(lv_enemiesNearby, c_unitCountAlive) <= 0)) {
        return ;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2189

        AISetFilterRange(lv_targetFilter2, lp_aIUnit, 10.0);
        AISetFilterLifeSortReference(lv_targetFilter2, 160.0, 40);
        lv_canidates = AIGetFilterGroup(lv_targetFilter2, lp_nearByUnits);
        AISetFilterBits(lv_targetFilter2, UnitFilter((1 << c_targetFilterVisible), 0, (1 << c_targetFilterMissile) | (1 << c_targetFilterBuried), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterInvulnerable - 32))));
        lv_harmlessCandidates = AIGetFilterGroup(lv_targetFilter2, lp_nearByUnits);

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2191

        lv_canidates = AIGetFilterGroup(lv_targetFilter2, lp_nearByUnits);
        AISetFilterBits(lv_targetFilter2, UnitFilter((1 << c_targetFilterVisible), 0, (1 << c_targetFilterMissile) | (1 << c_targetFilterBuried), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterHallucination - 32)) | (1 << (c_targetFilterInvulnerable - 32))));
        lv_harmlessCandidates = AIGetFilterGroup(lv_targetFilter2, lp_nearByUnits);
        if ((UnitGroupUnit(lv_canidates, UnitGroupCount(lv_canidates, c_unitCountAlive)) != null)) {
            libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonZagaraBanelingBarrage", 0), UnitGetPosition(UnitGroupUnit(lv_canidates, UnitGroupCount(lv_canidates, c_unitCountAlive)))));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2211


    AISetFilterPlane(lv_targetFilter3, c_planeGround);
    lv_roachCandidates = AIGetFilterGroup(lv_targetFilter3, lp_nearByUnits);
    if ((UnitAbilityGetCooldown(lp_aIUnit, "MutatorAmonZagaraMassRoachDrop", "MutatorAmonZagaraInfestedPods") <= 0.0) && (UnitGroupCount(lv_roachCandidates, c_unitCountAlive) > 0)) {
        lv_abilityRange = 13.0;

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOMU.galaxy:2269

    // Implementation
    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    if ((UnitAbilityGetCooldown(lp_aIUnit, "MutatorAmonArtanisAstralWind", "Abil/MutatorAmonArtanisAstralWind") <= 0.0) && ((UnitGetPropertyFixed(lp_aIUnit, c_unitPropShieldsMax, c_unitPropCurrent) - UnitGetPropertyFixed(lp_aIUnit, c_unitPropShields, c_unitPropCurrent)) > 150.0)) {
        libNtve_gf_AICast(lp_aIUnit, Order(AbilityCommand("MutatorAmonArtanisAstralWind", 0)));

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:81

	AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_DefilerDarkSwarm);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
	nearbyAlliedUnits = AIGetFilterGroup(filter, nearbyAlliedUnits);
	
    loc = AIBestTargetPoint(

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:223

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);

    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:602

    AISetFilterLifePerMarker(filter, damage*0.5, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:798

    AISetFilterLifePerMarker(filter, damage, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:889

    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridFAoEStunMin) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:920

    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);

    candidateGroup = AIGetFilterGroup(filter, scanGroup);
    if (candidateGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:995

    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage);

    candidateGroup = AIGetFilterGroup(filter, scanGroup);
    if (candidateGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1058

    airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_GravitonPrison, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1115

    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    
    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup != null) {
        returnOrd = AIUnitGroupGetValidOrder(enemyGroup, ord, aiUnit, c_backwards);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactCampAI.galaxy:1157

    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridCShockWaveMin) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:53

    AISetFilterPlane(filterAI, c_planeGround);
    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);

    // Is there a threat in the area

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:64

    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

    // Setup a friendly filter

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:133

        filterAI = AIFilter(player);
        AISetFilterMelee(filterAI, c_onlyRanged);
        rangeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

        // see if there is a large group nearby to split

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:513

    filter = AIFilter(player);
    AISetFilterInCombat(filter, c_onlyInCombat);
    inCombatEnemies = AIGetFilterGroup(filter, scanGroup);
    if (UnitGroupCount(inCombatEnemies, c_unitCountAll) < minEnemies) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:549

    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);
    AISetFilterBehaviorCount(filterAI, c_noBehaviorMin, c_noBehaviorMax, c_BF_TemporalField);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, scanGroup);

    // see if there is a large enough group nearby

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1046

    AISetFilterBits(filter, UnitFilterStr(AIAbilityStr(player, c_AB_ChronoBoost, c_fieldTargetFiltersAB)));
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_TimeWarp);
    prodGroup = AIGetFilterGroup (filter, prodGroup);
    if (prodGroup == null) {
        return;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1152

    filterAI = AIFilter(player);
    AISetFilterPlane(filterAI, c_planeGround);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);
    groundCount = UnitGroupCount(groundEnemies, c_unitCountAlive);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1182

    filterAI = AIFilter(player);
    AISetFilterPlane(filterAI, c_planeGround);
    groundEnemies = AIGetFilterGroup(filterAI, scanGroup);

    if (UnitGroupCount(groundEnemies, c_unitCountAlive) > 0) {

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1563

    AISetFilterLifeSortReference(filter, c_aiDisintegrationDamage, c_aiDisintegrationDamage*c_distanceFromDamage); 

    enemyGroup = AIGetFilterGroup(filter, scanGroup);
    if (enemyGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:71

    //  Select starting from the end, which is the target that has health closest to the cannon's damage
    //
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:222

    AISetFilterLifeSortReference(filterAI, damage, damage*c_distanceFromDamage);

    targetGroup = AIGetFilterGroup(filterAI, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:275

    //  damage.
    //
    targetGroup = AIGetFilterGroup(filterAI, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:443

    AISetFilterLifePerMarker(filter, damage, mark);
    AISetFilterLifeSortReference(filter, damage, damage*c_distanceFromDamage); 
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:848

                    AISetFilterMelee(filter, c_onlyRanged);
                    AISetFilterValidPassenger(filter, aiUnit);
                    nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);
                }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:875

            AISetFilterMelee(filter, c_onlyRanged);
            AISetFilterValidPassenger(filter, aiUnit);
            nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);
        }

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1143

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterSelf(filter, aiUnit);
    targetGroup = AIGetFilterGroup(filter, targetGroup);

    scanCount = UnitGroupCount(targetGroup, c_unitCountAll);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1163

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterSelf(filter, aiUnit);
    targetGroup = AIGetFilterGroup(filter, targetGroup);

    scanCount = UnitGroupCount(targetGroup, c_unitCountAll);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1214

    //  damage.
    //
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:1601

    AISetFilterLifeSortReference(filter, c_minLockOnDamage, c_minLockOnDamage*c_distanceFromDamage);

    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null || UnitGroupCount(targetGroup, c_unitCountAll) == 0) {
        return;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:34

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterLifeLost(filter, AIEffectFixed(player, c_EF_Transfusion, c_fieldEffectChange0) - 20, c_noMax);
    group = AIGetFilterGroup(filter, group);
    if (group == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:258

    AISetFilterPlane(filter, c_planeGround);
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperDisablingCloud);
    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:297

    AISetFilterPlane(filter, c_planeGround);
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperCloudBuff);
    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:384

    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperParasiticBomb);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    airGroup = AIGetFilterGroup(filter, scanGroup);
    
    loc = AIBestTargetPoint(

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:428

    
    consumptionTargets = AIFindUnits(player, null, UnitGetPosition(aiUnit), 5.0, c_noMaxCount);
    consumptionTargets = AIGetFilterGroup(filter, consumptionTargets);
    if (consumptionTargets == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:692

    AISetFilterAlliance(groundAirFilter, c_playerGroupEnemy);
    AISetFilterPlane(groundAirFilter, c_planeGround);
    enemyGroundCount = UnitGroupCount(AIGetFilterGroup(groundAirFilter, scanGroup), c_unitCountAlive);

    AISetFilterPlane(groundAirFilter, c_planeAir);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:695


    AISetFilterPlane(groundAirFilter, c_planeAir);
    enemyAirCount = UnitGroupCount(AIGetFilterGroup(groundAirFilter, scanGroup), c_unitCountAlive);

    //  Apply filters to enemies

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:706

    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    AISetFilterCanAttackEnemy(filter, enemyGroundCount, enemyAirCount);
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:715

    filter = AIFilter(player);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, gameMark);
    targetGroup = AIGetFilterGroup(filter, targetGroup);
    if (targetGroup == null) {
        return null;

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TactZergAI.galaxy:746

    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_FungalGrowth);
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, gameMark);
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:144

    AISetFilterRange(filter, aiUnit, AIAbilityFixed(player, c_AB_LightningShield, c_fieldRange0));
    AISetFilterMarker(filter, c_noMarkersMin, c_noMarkersMax, mark);
    targetGroup = AIGetFilterGroup(filter, scanGroup);
    if (targetGroup == null) {
        return null;

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:200

    AISetFilterLifeSortReference(filterBonus, damage, damage*c_distanceFromDamage);
    //Killable Hero
    targets= AIGetFilterGroup(filterKillable, heroes);
    if(!UnitGroupIsEmpty(targets)){
        return targets;