# Get Coop Flag
Grammar — Gets the current value of the coop flag at index index for player player
Flags —Native
|Function
Gets the current value of the specified coop flag index for a player.
# Arguments
int
— Playerint
— Index
Returns — bool
native bool AIGetCoopFlag(int player, int index);
# Related
Category: AI Advanced / Utility / Functions
- Is Point In Shrub —
bool
— InShrub - Is Campaign AI —
bool
— AIIsCampaign - Grab Unit —
unit
— AIGrabUnit - Get State —
int
— AIState - Get Flag —
bool
— AIGetFlag - Get Coop Flag —
bool
— AIGetCoopFlag - Unit Has AI Option —
bool
— UnitGetAIOption - Wants To Surrender —
bool
— AIGivingUp - AI Pathing Cost Map —
int
— AIPathingCostMap - AI Pathing Cost Unit —
int
— AIPathingCostUnit - AI Self Reinforce Point —
point
— AISelfReinforceDropPoint
# Examples
mods/core.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:164
}
if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
if (AIWaveUnitCount(AIWaveGet(player, c_waveAttack)) > 0) {
return;
mods/core.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeHighAI.galaxy:164
}
if (AIGetCoopFlag(player, c_coopWaveAttacker)) {
if (AIWaveUnitCount(AIWaveGet(player, c_waveAttack)) > 0) {
return;
mods/warcoop/warmeleeai.sc2mod — base.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.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:754
if (state == e_attackState_Attack) {
if (AIGetFlag(player, e_flagsAllowRetreat) && !AIGetCoopFlag(player, c_coopWaveAttacker)) {
// retreat logic
time = AIWaveGetTimeInCombat(w);