# Tactical AI Filter Melee

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

# Arguments

Returns — void

native void AISetFilterMelee(aifilter filter, bool want);

Category: AI Advanced / Filters / Actions

# Examples

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

    // Get a list of only melee enemies
    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

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

        // filter only ranged units
        filterAI = AIFilter(player);
        AISetFilterMelee(filterAI, c_onlyRanged);
        rangeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

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

    // Filter out air units, non-melee units, and units already in a temporal field
    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    AISetFilterPlane(filterAI, c_planeGround);
    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);

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

                if (wanted == c_nullString) {
                    filter = AIFilter(player);
                    AISetFilterMelee(filter, c_onlyRanged);
                    AISetFilterValidPassenger(filter, aiUnit);
                    nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);

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

        if (wanted == c_nullString) {
            filter = AIFilter(player);
            AISetFilterMelee(filter, c_onlyRanged);
            AISetFilterValidPassenger(filter, aiUnit);
            nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);

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

    
    filter = AIFilter(player);
    AISetFilterMelee(filter, c_onlyRanged);
    AISetFilterPlane(filter, c_planeGround);
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperCloudBuff);

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

    // Get a list of only melee enemies
    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    meleeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

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

        // filter only ranged units
        filterAI = AIFilter(player);
        AISetFilterMelee(filterAI, c_onlyRanged);
        rangeEnemyGroup = AIGetFilterGroup(filterAI, groundEnemies);

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

    // Filter out air units, non-melee units, and units already in a temporal field
    filterAI = AIFilter(player);
    AISetFilterMelee(filterAI, c_onlyMelee);
    AISetFilterPlane(filterAI, c_planeGround);
    AISetFilterCanAttackAlly(filterAI, c_groundAlliesNearby, false);

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

                if (wanted == c_nullString) {
                    filter = AIFilter(player);
                    AISetFilterMelee(filter, c_onlyRanged);
                    AISetFilterValidPassenger(filter, aiUnit);
                    nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);

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

        if (wanted == c_nullString) {
            filter = AIFilter(player);
            AISetFilterMelee(filter, c_onlyRanged);
            AISetFilterValidPassenger(filter, aiUnit);
            nearBunkerGroup = AIGetFilterGroup(filter, nearBunkerGroup);

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

    
    filter = AIFilter(player);
    AISetFilterMelee(filter, c_onlyRanged);
    AISetFilterPlane(filter, c_planeGround);
    AISetFilterBehaviorCount(filter, c_noBehaviorMin, c_noBehaviorMax, c_BF_ViperCloudBuff);

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


    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    AISetFilterMelee(lv_enemyNearbyFilter, false);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    auto2822F891_g = lv_enemiesNearby;

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


    AISetFilterAlliance(lv_enemyNearbyFilter, c_playerGroupEnemy);
    AISetFilterMelee(lv_enemyNearbyFilter, false);
    lv_enemiesNearby = AIGetFilterGroup(lv_enemyNearbyFilter, lp_nearByUnits);
    auto9461D501_g = lv_enemiesNearby;