# Get Default Combat Priority

Grammar — Pick the best target for attackers attackers who currently have target from enemy list enemies, it also changes the attackers list to only include units who want to switch to that target up to a limit of maxAttackersLimit units
FlagsNative | Function

Returns a unit that is the best target for the specified attackers from the list of possible units in the specified enemy unit group. It then also changes the attackers group to only include the limited number of attackers wanting to switch to that target.

# Arguments

  • unitgroup — Attackers
  • unitgroup — Enemies
  • int — Max Attackers Limit

Returns — unit

native unit AIDefaultCombatPriority(
	unitgroup attackers,
	unitgroup enemies,
	int maxAttackerLimit,
);

Category: AI Advanced / Tactical / Functions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:311

    // return c_nullUnit if no units need to switch target

    return AIDefaultCombatPriority(attackers, enemies, maxAttackerLimit);
}

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/MeleeAI.galaxy:311

    // return c_nullUnit if no units need to switch target

    return AIDefaultCombatPriority(attackers, enemies, maxAttackerLimit);
}