# Get Coop Flag

Grammar — Gets the current value of the coop flag at index index for player player
FlagsNative | Function

Gets the current value of the specified coop flag index for a player.

# Arguments

  • int — Player
  • int — Index

Returns — bool

native bool AIGetCoopFlag(int player, int index);

Category: AI Advanced / Utility / Functions

# Examples

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeBuildAI.galaxy:430

    // if we haven't choosen an opening build type, do so now
    if (AIGetUserInt(player, c_openingBuildType) == e_buildType_Invalid) {
        if (AIGetCoopFlag(player, c_coopTraining)) {
            AISetUserInt(player, c_openingBuildType, e_buildType_Timing);
        }

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeBuildAI.galaxy:543

        randomRoll = RandomInt(1, 100);

        if (AIGetCoopFlag(player, c_coopTraining)) {
            if (randomRoll < 10) {              // 10%
                AISetUserInt(player, c_lateGameBuildType, e_buildType_Mixed);

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:133

    bool goAttack = false;

    if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
        if (AIState(player, e_attackState) != e_attackState_Wait) {
            goAttack = true;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:164

    }

    if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
        if (AIWaveUnitCount(AIWaveGet(player, c_waveAttack)) > 0) {
            return;

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeLowAI.galaxy:157


    // coop attacker logic
    if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
        if (AIGetTime() > 330) {
            if (AIState(player, e_attackState) == e_attackState_Wait) {

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:657

        return;
    }
    if (AIGetCoopFlag(player, c_coopTurtle)) {
        if (AIWaveState(w) != c_waveStateIdle) {
            DebugAIPlayerWave(player, "turtle set attack = idle at gather offense");

mods/core.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:668


    if (state == e_attackState_Attack) {
        if (AIGetFlag(player, e_flagsAllowRetreat) && !AIGetCoopFlag(player, c_coopWaveAttacker)) {
            // retreat logic
            time = AIWaveGetTimeInCombat(w);

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:133

    bool goAttack = false;

    if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
        if (AIState(player, e_attackState) != e_attackState_Wait) {
            goAttack = true;

mods/void.sc2modbase.sc2data/TriggerLibs/MeleeHighAI.galaxy:164

    }

    if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
        if (AIWaveUnitCount(AIWaveGet(player, c_waveAttack)) > 0) {
            return;

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:743

        return;
    }
    if (AIGetCoopFlag(player, c_coopTurtle)) {
        if (AIWaveState(w) != c_waveStateIdle) {
            DebugAIPlayerWave(player, "turtle set attack = idle at gather offense");

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/MeleeWaveAI.galaxy:754


    if (state == e_attackState_Attack) {
        if (AIGetFlag(player, e_flagsAllowRetreat) && !AIGetCoopFlag(player, c_coopWaveAttacker)) {
            // retreat logic
            time = AIWaveGetTimeInCombat(w);