# Is Campaign AI

Grammar — Player player is running campaign AI
FlagsNative | Function

Returns whether a player is running campaign AI (as opposed to melee AI).

# Arguments

  • int — Player

Returns — bool

native bool AIIsCampaign(int player);

Category: AI Advanced / Utility / Functions

# Examples

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

    ord = AIOrderLokiYamato(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campExpert) {
            cooldown = 8.0;
        }

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

    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (AIIsCampaign(player) && UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridCShockWaveMin) {
        return null;
    }

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

    ord = AIOrderLokiYamato(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campExpert) {
            cooldown = 8.0;
        }

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

    enemyGroup = AIGetFilterGroup(enemyFilter, enemyGroup);

    if (AIIsCampaign(player) && UnitGroupCount(enemyGroup, c_unitCountAll) < c_hybridCShockWaveMin) {
        return null;
    }

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

    ord = QueenMPEnsnare(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campAdvanced) {
            cooldown = 15.0;
        }

mods/core.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:217

//--------------------------------------------------------------------------------------------------
bool AICampSkirDiffTest (int player, int campMinDiff, int skirMinDiff) {
    if (AIIsCampaign(player)) {
        return AIPlayerDifficulty(player) >= campMinDiff;
    }

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

    point forceFieldTarget = null;

    if (AIIsCampaign(player)) {
        return false;
    }

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

    unitgroup targetGroupGround;

    if (AIIsCampaign(player)) {
        return false;
    }

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

    int minEnemies;

    if (AIIsCampaign(player)) {
        return null;
    }

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

    point targetPoint;

    if (AIIsCampaign(player)) {
        return null;
    }

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

    unitgroup targetGroup;
    
    if (AIIsCampaign(player)) {
        return null;
    }

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

    unit targetUnit;
    
    if (AIIsCampaign(player)) {
        return false;
    }

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

    unitgroup enemyGroup;

    if (!AIIsCampaign(player) || AIPlayerDifficulty(player) >= c_campAdvanced) {
        if (AITactCooldownAllow(aiUnit, c_psiStormCooldown)) {
            // psi storm

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

            // psi storm
            if (AIEvalTacticalData(aiUnit, null)) {        
                if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campExpert) {
                    AISetCooldown(aiUnit, c_psiStormCooldown, 5.0);
                }

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

    }

    if (AIIsCampaign(player)) {
        // not using feedback or merge to survive in campaign
        return;

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

    }

    if (AIIsCampaign(player)) {
        if (AIPlayerDifficulty(player) < c_campExpert) {
            return;

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

    marker mark;
    
    if (AIIsCampaign(player)) {
        if (AIPlayerDifficulty(player) < c_campAdvanced) {
            return;

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

    //  Add a delay on campaign.
    //
    if (AIIsCampaign(player)) {
        if (RandomInt(0, c_ghostMaxRandom) != 1) {
            return;

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

    }

    if (!AIIsCampaign(player) || AIPlayerDifficulty(player) >= c_campAdvanced) {
        // cloaking will be disabled by xml on campaign
        // cloaking & emp

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

    ord = AIOrderSnipe(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player)) {
            if (AIPlayerDifficulty(player) < c_campAdvanced) {
                cooldown = 8.0;

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

    ord = AIOrderSteadyTargeting(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player)) {
            if (AIPlayerDifficulty(player) < c_campAdvanced) {
                cooldown = 8.0;

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

    }

    if (AIIsCampaign(player)) {
        if (AIPlayerDifficulty(player) < c_campAdvanced) {
            return null;

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

    fixed cooldown;

    if (AIIsCampaign(player)) {
        if (AIEvalTacticalData(aiUnit, null)) {
            return;

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

    ord = AIOrderYamato(player, aiUnit, scanGroup, mark);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campExpert) {
            cooldown = 8.0;
        }

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

    }
        
    if (!AIIsCampaign(player)) {
        ord = AITacticalJump(player, aiUnit, scanGroup);
        if (ord != null) {

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

        //  Both checks are needed because auto loading bunkers is needed on campaign before the
        //  AI is active.....
        if (AIIsCampaign(player)) {
            autoLoad = true;
        }

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

    aifilter filter;

    if (AIIsCampaign(player)) {
        if (AIPlayerDifficulty(player) < c_campAdvanced) {
            return null;

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

    point p;

    if (AIIsCampaign(player)) {
        return null;
    }

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

    point p;

    if (AIIsCampaign(player)) {
        return;
    }

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

    int enemyAirCount;

    if (AIIsCampaign(player)) {
        return null;
    }

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

    ord = FungalGrowth(player, aiUnit, mark, gameMark, scanGroup);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campAdvanced) {
            cooldown = 15.0;
        }

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

    ord = InfestedTerrans(player, aiUnit, scanGroup, lowVitality);
    if (ord != null) {
        if (AIIsCampaign(player) && AIPlayerDifficulty(player) < c_campAdvanced) {
            cooldown = 3.0;
        }

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

    int enemyGroundCount;

    if (AIIsCampaign(player)) {
        // don't auto make changlings on campaign
        return false;

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

    aifilter filter;

    if (AIIsCampaign(player)) {
        return null;
    }

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

    marker mark;

    if (AIIsCampaign(player)) {
        if (AIPlayerDifficulty(player) < c_campAdvanced) {
            return;

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

    order ord;

    if (AIIsCampaign(player)) {
        return;
    }

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:783

        lv_player = PlayerGroupNextPlayer(auto1DA84066_g, lv_player);
        if (lv_player < 0) { break; }
        if ((PlayerType(lv_player) == c_playerTypeComputer) && (AIIsCampaign(lv_player) == false)) {
            lv_meleeAIUsed = true;
            break;

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:799

        lv_player = PlayerGroupNextPlayer(auto576EC8AD_g, lv_player);
        if (lv_player < 0) { break; }
        if ((PlayerType(lv_player) == c_playerTypeComputer) && (AIIsCampaign(lv_player) == false)) {
            if ((AIGivingUp(lv_player) == true) && (PlayerGroupHasPlayer(libLbty_gv_meleeSurrender_PlayersSurrendering, lv_player) == false) && (PlayerGroupHasPlayer(libLbty_gv_meleeSurrender_PlayersTried, lv_player) == false)) {
                libLbty_gf_MeleeSurrender_AIWantToSurrender(lv_player);

mods/starcoop/starcoop.sc2modbase.sc2data/TriggerLibs/Tactical/TacticalAI.galaxy:217

//--------------------------------------------------------------------------------------------------
bool AICampSkirDiffTest (int player, int campMinDiff, int skirMinDiff) {
    if (AIIsCampaign(player)) {
        return AIPlayerDifficulty(player) >= campMinDiff;
    }

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

	}
	
    if (AIIsCampaign(player)) {
        if (RandomInt(0, c_oracleWardMaxRandom) != 1) {
            return null;