# Get Best Target Point On Group

Grammar — Returns the best location to place and AOE attack on the group with the specified parameters (group, minHits, damageBase, minScore, radius, from, range, bonusAttribute)
FlagsNative | Function

Returns the best location to place an AOE attack on a group of units with the specified parameters.

# Arguments

  • unitgroup — Group
  • int — Min Hits
  • int — Damage Base
  • fixed — Min Score
  • fixed — Radius
  • point — From
  • fixed — Range
  • int — Bonus Attribute

Returns — point

native point AIBestTargetPoint(
	unitgroup group,
	int minHits,
	int damageBase,
	fixed minScore,
	fixed radius,
	point from,
	fixed range,
	int bonusAttri,
);

Category: AI Advanced / Tactical / Functions

# Examples

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OdinBarrageArea, scanGroup),
        3, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OmegaStormArea, scanGroup),
        3, // min hits

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

    range = AIAbilityFixed(player, c_AB_BioStasis, c_fieldRange0) + 1;

    loc = AIBestTargetPoint(
        statisGroup,
        5, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OdinBarrageArea, scanGroup),
        3, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OmegaStormArea, scanGroup),
        3, // min hits

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

    range = AIAbilityFixed(player, c_AB_BioStasis, c_fieldRange0) + 1;

    loc = AIBestTargetPoint(
        statisGroup,
        5, // min hits

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

    }

    loc = AIBestTargetPoint(
        enemyGroup,
        2, // min hits

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


        // see if there is a large group nearby to split
        forceFieldTarget = AIBestTargetPoint(
            rangeEnemyGroup,
            6, // min hits

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


    // see if there is a large enough group nearby
    targetPoint = AIBestTargetPoint(
        meleeEnemyGroup,
        4, // min hits

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

    vortexGroup = AIEffectGroup(player, c_EF_VortexArea, scanGroup);

    loc = AIBestTargetPoint(
        vortexGroup,
        5, // min hits

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

    }
    
    loc = AIBestTargetPoint(
        targetGroup,
        3, // min hits

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

    }
    
    loc = AIBestTargetPoint(
        targetGroup,
        3, // min hits

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

    barrageRadius = AIEffectFixed(player, c_EF_BombardmentArea, c_fieldAreaRadius0);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_BombardmentArea, scanGroup),
        3, // min hits

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

    //  Up to an additional 1.0 point can be rewarded if the target has the optional bonus attribute.
    //
    loc = AIBestTargetPoint(
        AIWeaponGroup(player, c_WE_AutoTurret, scanGroup),
        2, // min hits

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


    // find the best area to attack on the ground
    bestPoint = AIBestTargetPoint(
        targetGroupGround,
        minHits, // min hits

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

    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_ViperCloudSearch, rangedGroup),
        5, // min hits

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

    airGroup = AIGetFilterGroup(filter, scanGroup);
    
    loc = AIBestTargetPoint(
        airGroup,
        1, // min hits

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

    enemyGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_FungalGrowthSearch, enemyGroup),
        5, // min hits

mods/novastoryassets.sc2modbase3.sc2maps/maps/campaign/nova/nova09.sc2map/MapScript.galaxy:727

            UnitGroupAddUnitGroup(lv_nearbyValidUnits, UnitGroup(null, gv_pLAYER_07_DOMINION, RegionCircle(UnitGetPosition(lp_rocketBarrageUnit), 14.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
            if ((UnitGroupCount(lv_nearbyValidUnits, c_unitCountAlive) > 0)) {
                lv_targetPoint = AIBestTargetPoint(lv_nearbyValidUnits, 0, 200, 0.0, 5.0, UnitGetPosition(lp_rocketBarrageUnit), 14.0, 0);
                UnitIssueOrder(lp_rocketBarrageUnit, OrderTargetingPoint(AbilityCommand("NovaXanthosRocketBarrage", 0), lv_targetPoint), c_orderQueueReplace);
            }

mods/novastoryassets.sc2modbase3.sc2maps/maps/campaign/nova/nova09.sc2map/MapScript.galaxy:1149

    else {
        if ((UnitGroupCount(lv_nearbyValidUnits, c_unitCountAlive) > 0)) {
            libNtve_gf_AICast(lp_xanthos, OrderTargetingPoint(AbilityCommand("NovaXanthosDeathLaser", 0), AIBestTargetPoint(lv_nearbyValidUnits, 0, 250, 0.0, 2.5, UnitGetPosition(lp_xanthos), 10.0, 0)));
        }

mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova09.sc2mapMapScript.galaxy:727

            UnitGroupAddUnitGroup(lv_nearbyValidUnits, UnitGroup(null, gv_pLAYER_07_DOMINION, RegionCircle(UnitGetPosition(lp_rocketBarrageUnit), 14.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0));
            if ((UnitGroupCount(lv_nearbyValidUnits, c_unitCountAlive) > 0)) {
                lv_targetPoint = AIBestTargetPoint(lv_nearbyValidUnits, 0, 200, 0.0, 5.0, UnitGetPosition(lp_rocketBarrageUnit), 14.0, 0);
                UnitIssueOrder(lp_rocketBarrageUnit, OrderTargetingPoint(AbilityCommand("NovaXanthosRocketBarrage", 0), lv_targetPoint), c_orderQueueReplace);
            }

mods/novastoryassets.sc2mod/base3.sc2maps/maps/campaign/nova/nova09.sc2mapMapScript.galaxy:1149

    else {
        if ((UnitGroupCount(lv_nearbyValidUnits, c_unitCountAlive) > 0)) {
            libNtve_gf_AICast(lp_xanthos, OrderTargetingPoint(AbilityCommand("NovaXanthosDeathLaser", 0), AIBestTargetPoint(lv_nearbyValidUnits, 0, 250, 0.0, 2.5, UnitGetPosition(lp_xanthos), 10.0, 0)));
        }

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

    lv_abilityAoE = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "MutatorAmonTychusTossGrenadeDamage", "AreaArray[" + IntToString(0) + "].Radius", c_playerAny));
    lv_score = 1;
    lv_target = AIBestTargetPoint(UnitGroupFilterAlliance(lp_nearByUnits, lp_owner, c_unitAllianceEnemy, 0), 3, lv_abilityDamage, lv_score, lv_abilityAoE, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
    if ((lv_target != null)) {
        libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonTychusTossGrenade", 0), lv_target));

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

    lv_score = 1;
    lv_abilityAoE = 0.5;
    lv_target = AIBestTargetPoint(UnitGroupFilterAlliance(lp_nearByUnits, lp_owner, c_unitAllianceEnemy, 0), 1, lv_abilityDamage, lv_score, lv_abilityAoE, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
    if ((lv_target != null)) {
        libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonRaynorSnipe", 0), lv_target));

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

        lv_abilityAoE = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "MutatorAmonNovaNukeDamage", "AreaArray[" + IntToString(0) + "].Radius", c_playerAny));
        lv_score = 2;
        lv_target = AIBestTargetPoint(lv_enemiesNearby, 4, FixedToInt(lv_abilityDamage), lv_score, lv_abilityAoE, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
        if ((lv_target != null)) {
            lv_wave = AIUnitGetWave(lp_aIUnit);

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

        lv_score = 3;
        lv_abilityAoE = 5.0;
        lv_target = AIBestTargetPoint(UnitGroupFilterAlliance(lp_nearByUnits, lp_owner, c_unitAllianceEnemy, 0), 2, lv_abilityDamage, lv_score, lv_abilityAoE, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
        if ((lv_target != null)) {
            libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonZagaraMassRoachDrop", 0), lv_target));

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

        lv_abilityAoE = StringToFixed(CatalogFieldValueGet(c_gameCatalogEffect, "MutatorAmonArtanisLightningDashSearch", "AreaArray[" + IntToString(0) + "].Radius", lp_owner));
        lv_score = 2;
        lv_target = AIBestTargetPoint(UnitGroupFilterAlliance(lp_nearByUnits, lp_owner, c_unitAllianceEnemy, 0), 3, lv_abilityDamage, lv_score, lv_abilityAoE, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
        if ((lv_target != null)) {
            libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonArtanisLightningDash", 0), lv_target));

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

        lv_abilityRadius = MinI(FixedToInt(lv_abilityRadius), 4);
        lv_score = 1;
        lv_target = AIBestTargetPoint(lv_enemiesNearby, 4, lv_abilityDamage, lv_score, lv_abilityRadius, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeStructure);
        if ((lv_target != null)) {
            libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonKerriganApocalypse", 0), lv_target));

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

        lv_score = 2;
        lv_canidates = UnitGroupFilter(null, c_playerAny, lv_enemiesNearby, UnitFilter(0, 0, (1 << c_targetFilterAir) | (1 << c_targetFilterStructure) | (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);
        lv_target = AIBestTargetPoint(lv_canidates, 3, lv_abilityDamage, lv_score, lv_abilityRadius, UnitGetPosition(lp_aIUnit), lv_abilityRange, c_unitAttributeNone);
        if ((lv_target != null)) {
            libNtve_gf_AICast(lp_aIUnit, OrderTargetingPoint(AbilityCommand("MutatorAmonKerriganPsiStrikeWalk", 0), lv_target));

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

	plagueGroup = AIEffectGroup(player, c_EF_PlagueArea, scanGroup);
	
	loc = AIBestTargetPoint(
		plagueGroup,
		5,		// min hits

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

	nearbyAlliedUnits = AIGetFilterGroup(filter, nearbyAlliedUnits);
	
    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_DefilerDarkSwarm, nearbyAlliedUnits),
        5, // min hits

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

    }

    loc = AIBestTargetPoint(
        enemyGroup,
        2, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OdinBarrageArea, scanGroup),
        3, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OmegaStormArea, scanGroup),
        3, // min hits

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

    range = AIAbilityFixed(player, c_AB_BioStasis, c_fieldRange0) + 1;

    loc = AIBestTargetPoint(
        statisGroup,
        5, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_PsiStormArea, scanGroup),
        1, // min hits

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

    }

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_OdinBarrageArea, scanGroup),
        3, // min hits

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


        // see if there is a large group nearby to split
        forceFieldTarget = AIBestTargetPoint(
            rangeEnemyGroup,
            6, // min hits

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


    // see if there is a large enough group nearby
    targetPoint = AIBestTargetPoint(
        meleeEnemyGroup,
        4, // min hits

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

    vortexGroup = AIEffectGroup(player, c_EF_VortexArea, scanGroup);

    loc = AIBestTargetPoint(
        vortexGroup,
        5, // min hits

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

    }
    
    loc = AIBestTargetPoint(
        targetGroup,
        3, // min hits

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

    }
    
    loc = AIBestTargetPoint(
        targetGroup,
        3, // min hits

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

    barrageRadius = AIEffectFixed(player, c_EF_BombardmentArea, c_fieldAreaRadius0);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_BombardmentArea, scanGroup),
        3, // min hits

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

    //  Up to an additional 1.0 point can be rewarded if the target has the optional bonus attribute.
    //
    loc = AIBestTargetPoint(
        AIWeaponGroup(player, c_WE_AutoTurret, scanGroup),
        2, // min hits

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


    // find the best area to attack on the ground
    bestPoint = AIBestTargetPoint(
        targetGroupGround,
        minHits, // min hits

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

    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_ViperDisablingCloudSearch, rangedGroup),
        5, // min hits

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

    rangedGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_ViperCloudSearch, rangedGroup),
        5, // min hits

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

    airGroup = AIGetFilterGroup(filter, scanGroup);
    
    loc = AIBestTargetPoint(
        airGroup,
        1, // min hits

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

    enemyGroup = AIGetFilterGroup(filter, scanGroup);

    loc = AIBestTargetPoint(
        AIEffectGroup(player, c_EF_FungalGrowthSearch, enemyGroup),
        5, // min hits