# Is In Combat

Grammar — Unit unit is in combat
FlagsNative | Function

# Arguments

  • unit — Unit

Returns — bool

native bool AIUnitIsInCombat(unit u);

Category: AI Advanced / Tactical / Functions

# Examples

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

static bool GuardianShield (int player, unit aiUnit, unitgroup scanGroup) {
    order ord;
    if (!AIUnitIsInCombat(aiUnit)) {
        return false;
    }

mods/core.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:284

        return null;
    }
    if(!AIUnitIsInCombat(aiUnit)){
        return null;       
    }

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:297

        return null;
    }
    if(!AIUnitIsInCombat(aiUnit)){
        return null;       
    }

mods/warcoop/warclassicsystem.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:409

        return;
    }
	if(!AIUnitIsInCombat(aiUnit)){
		return;
	}

mods/warcoop/warclassicsystem.sc2modbase.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.sc2modbase.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.sc2modbase.sc2data/TriggerLibs/WarClassicTactical.galaxy:340


    // Implementation
    if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
        return ;
    }

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


    // Implementation
    if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
        return ;
    }

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


    // Implementation
    if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
        return ;
    }

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


    // Implementation
    if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
        return ;
    }

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


    // Implementation
    if ((AIUnitIsInCombat(lp_aIUnit) == false)) {
        return ;
    }

mods/warcoop/warclassicsystem.sc2modbase.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