# Is In Combat
Grammar — Unit unit is in combat
Flags —Native
|Function
# Arguments
unit
— Unit
Returns — bool
native bool AIUnitIsInCombat(unit u);
# 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/Tactical/TactProtAI.galaxy:242
static bool GuardianShield (int player, unit aiUnit, unitgroup scanGroup) {
order ord;
if (!AIUnitIsInCombat(aiUnit)) {
return false;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:806
wantsToBeInBunker = false;
}
else if (!AIUnitIsInCombat(unitToCheck) && !AIUnitIsInCombat(aiUnit)) {
// Otherwise the unit will only want to be out of the bunker if not combat is happening
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:806
wantsToBeInBunker = false;
}
else if (!AIUnitIsInCombat(unitToCheck) && !AIUnitIsInCombat(aiUnit)) {
// Otherwise the unit will only want to be out of the bunker if not combat is happening
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:244
static bool GuardianShield (int player, unit aiUnit, unitgroup scanGroup) {
order ord;
if (!AIUnitIsInCombat(aiUnit)) {
return false;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:782
wantsToBeInBunker = false;
}
else if (!AIUnitIsInCombat(unitToCheck) && !AIUnitIsInCombat(aiUnit)) {
// Otherwise the unit will only want to be out of the bunker if not combat is happening
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:782
wantsToBeInBunker = false;
}
else if (!AIUnitIsInCombat(unitToCheck) && !AIUnitIsInCombat(aiUnit)) {
// Otherwise the unit will only want to be out of the bunker if not combat is happening
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:72
}
//Scroll of Regeneration
if(!AIUnitIsInCombat(aiUnit)){
if(UnitValidateEffectUnit(aiUnit,c_IT_ScrollofRegenerationAIValidateEffect,aiUnit)==0){
itemType=c_IT_ScrollofRegenerationAI;
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:284
return null;
}
if(!AIUnitIsInCombat(aiUnit)){
return null;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:297
return null;
}
if(!AIUnitIsInCombat(aiUnit)){
return null;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:409
return;
}
if(!AIUnitIsInCombat(aiUnit)){
return;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:212
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
if ((UnitOrderIsValid(lp_aIUnit, lv_cmdOff) == true)) {
libNtve_gf_AICast(lp_aIUnit, lv_cmdOff);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:277
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
if ((UnitOrderIsValid(lp_aIUnit, lv_cmdOff) == true)) {
libNtve_gf_AICast(lp_aIUnit, lv_cmdOff);
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:340
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
return ;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:381
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
return ;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:405
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
return ;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:429
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
return ;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:453
// Implementation
if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
return ;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/WarClassicTactical.galaxy:542
lv_order = libGAwT_gf_OrderConstructor(lp_owner, lp_abil, libGAwT_ge_OrderType_Target, lp_item);
lv_orderFinal = lv_order;
lv_checkDamage = AIUnitIsInCombat(lp_aIUnit);
// Implementation