# AISetFilterCanAttackAlly

FlagsNative

# Arguments

  • aifilter — filter
  • bool — groundAllies
  • bool — airAllies

Returns — void

native void AISetFilterCanAttackAlly(
	aifilter filter,
	bool groundAllies,
	bool airAllies,
);

Category: Unclassified

# Examples

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

    //  Only include enemies that can attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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

    //  Check for air allies.
    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) {

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


        airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_PlasmaBlast, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
        AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    }
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

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

    //  Only care if there are enemies that attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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

    //  Only include enemies that can attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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

    //  Check for air allies.
    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) {

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


        airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_PlasmaBlast, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
        AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    }
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

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

    //  Only care if there are enemies that attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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

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

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

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

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

                                  c_unitAllianceAlly)
                                  ;
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);

    //  Select starting from the end, which is the target that has health closest to the cannon's damage

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

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

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

    //  Only include enemies that can attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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

    //  Check for air allies.
    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) {

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

    
    airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, "HybridDominatorVoidPlasmaBlast", c_fieldRange0), c_planeAir, c_unitAllianceAlly);
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

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

    // Only care if there are enemies that attack our allies.
    enemyFilter = AIFilter(player);
    AISetFilterCanAttackAlly(enemyFilter, c_groundAlliesNearby, airAllies);
    AISetFilterBehaviorCount(enemyFilter, c_noBehaviorMin, c_noBehaviorMax, c_BF_PsionicShockwave);
    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

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


        airAllies = AINearbyPlaneTest(UnitGetPosition(aiUnit), player, AIAbilityFixed(player, c_AB_HybridPhaseShift, c_fieldRange0), c_planeAir, c_unitAllianceAlly);
        AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);
    }
    enemyGroup = AIGetFilterGroup(filter, scanGroup);

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

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

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

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

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

                                  c_unitAllianceAlly)
                                  ;
    AISetFilterCanAttackAlly(filter, c_groundAlliesNearby, airAllies);

    //  Select starting from the end, which is the target that has health closest to the cannon's damage

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

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