# Tactical AI Filter In Combat

Grammar — Tactical AI Filter - inCombat only in combat in filter
FlagsNative | Action

# Arguments

Returns — void

native void AISetFilterInCombat(
	aifilter filter,
	bool inCombat,
);

Category: AI Advanced / Filters / Actions

# Examples

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

        
        filter = AIFilter(player);
        AISetFilterInCombat(filter, c_onlyInCombat);
        AISetFilterRange(filter, unitToCheck, nearbyRange);
        nearbyEnemies = AIGetFilterGroup(filter, scanGroup);

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

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

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:588

    lv_rangeUnitFilter = AIFilter(lp_owner);
    lv_damage = libGAwT_gf_AIAbilAccumlatedAmount(lp_owner, lp_aIUnit, lp_abil, lv_level, "Damage");
    AISetFilterInCombat(lv_rangeUnitFilter, true);
    AISetFilterAlliance(lv_rangeUnitFilter, c_playerGroupEnemy);
    lv_unitsInRangeEnemyHeroes = AIGetFilterGroup(lv_rangeUnitFilter, UnitGroupFilter(null, c_playerAny, lv_unitsInRange, UnitFilter(0, (1 << (c_targetFilterHeroUnit - 32)), (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));