# 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
Flags —Native
|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
— Attackersunitgroup
— Enemiesint
— Max Attackers Limit
Returns — unit
native unit AIDefaultCombatPriority(
unitgroup attackers,
unitgroup enemies,
int maxAttackerLimit,
);
# Related
Category: AI Advanced / Tactical / Functions
- Same Command —
bool
— AISameCommand - Last Attacker —
unit
— AILastAttacker - Last Attack —
int
— AILastAttack - Get Wants To Move Status —
bool
— AIControlWantsToMove - Is Ignored By Wave —
bool
— AIIsIgnoredByWave - Is In Combat —
bool
— AIUnitIsInCombat - Get Cloaked Attacker —
point
— AIGetCloakedAttacker - Get Best Target Point On Group —
point
— AIBestTargetPoint - Find Units —
unitgroup
— AIFindUnits - Get Default Combat Priority —
unit
— AIDefaultCombatPriority - Combat Diff Flag Special High Priority —
bool
— AICombatDiffFlagCatSpecialHighPrio - Combat Diff Flag Splash High Priority —
bool
— AICombatDiffFlagCatSplashHighPrio - Combat Diff Flag Timed Low Priority —
bool
— AICombatDiffFlagCatTimedLowPrio - Combat Diff Flag Workers Normal Priority —
bool
— AICombatDiffFlagCatWorkersNormalPrio - Combat Diff Flag Sort Buildings Priority —
bool
— AICombatDiffFlagCatSortBuildingsPrio - Combat Diff Flag Healers —
bool
— AICombatDiffFlagTieBreakHealers - Combat Diff Flag Low Health —
bool
— AICombatDiffFlagTieBreakLowHP - Combat Diff Flag Bonus Damage —
bool
— AICombatDiffFlagTieBreakBonusDamage - Combat Diff Flag Injured —
bool
— AICombatDiffFlagTieBreakInjured - Combat Diff Flag Detector —
bool
— AICombatDiffFlagTieBreakDetector - Combat Diff Flag Siege Range —
bool
— AICombatDiffFlagTieBreakRange - Does Unit Have Tactical Disabled —
bool
— AIIsTacticalDisabled
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:311
// return c_nullUnit if no units need to switch target
return AIDefaultCombatPriority(attackers, enemies, maxAttackerLimit);
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/MeleeAI.galaxy:311
// return c_nullUnit if no units need to switch target
return AIDefaultCombatPriority(attackers, enemies, maxAttackerLimit);
}