# Wave State
Grammar — Get the state of wave waveRef
Flags —Native
|Function
Returns the state of a wave.
# Arguments
wave
— Wave
Returns — int
native int AIWaveState(wave w);
# Related
Category: AI Advanced / Waves / Functions
- Create Wave Info —
waveinfo
— AIWaveInfoCreate - Create Wave Info From Wave —
waveinfo
— AIWaveInfo - Create Wave —
wave
— AIWaveCreate - Wave Unit Count —
int
— AIWaveUnitCount - Wave State —
int
— AIWaveState - Wave Target Unit —
wavetarget
— AIWaveTargetUnit - Wave Target UnitGroup —
wavetarget
— AIWaveTargetUnitGroup - Wave Target Unit Point —
wavetarget
— AIWaveTargetUnitPoint - Wave Target Point —
wavetarget
— AIWaveTargetPoint - Wave Target Player —
wavetarget
— AIWaveTargetPlayer - Wave Target Melee —
wavetarget
— AIWaveTargetMelee - Wave Target Melee Harass —
wavetarget
— AIWaveTargetMeleeHarass - Wave Target Merge —
wavetarget
— AIWaveTargetMerge - Wave Target Patrol —
wavetarget
— AIWaveTargetPatrol - Wave Target Escort —
wavetarget
— AIWaveTargetEscort - Wave Target Escort No Leash —
wavetarget
— AIWaveTargetEscortNL - Wave Target Gather Offense —
wavetarget
— AIWaveTargetGatherO - Wave Target Gather Defense —
wavetarget
— AIWaveTargetGatherD - Wave Target Harass Retreat —
wavetarget
— AIWaveHarassRetreat - Wave Target Region —
wavetarget
— AIWaveTargetRegion - Wave Get Target —
wavetarget
— AIWaveGetTarget - Is Wave In Combat —
bool
— AIWaveIsInCombat - Wave Time In Combat —
int
— AIWaveGetTimeInCombat - Wave Time Since Combat —
int
— AIWaveGetTimeSinceCombat - Wave Time Since Ordered —
int
— AIWaveGetTimeSinceOrdered - Wave Eval —
int
— AIWaveEval - Wave Eval Ratio —
int
— AIWaveEvalRatio - Eval Ratio —
int
— AIEvalRatio - Wave Get —
wave
— AIWaveGet - Wave Type —
int
— AIWaveType - Get Best Attack Target Point —
point
— AIGetBestTarget - Wave To String —
string
— AIWaveToString - Wave To Text —
text
— AIWaveToText
# Examples
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:59
"wave=" + name +
", units=" + IntToString(AIWaveUnitCount(w)) +
", state=" + WaveStateName(AIWaveState(w)) +
", ratio=" + IntToString(AIWaveEvalRatio(w, c_evalRange)) +
", combat=" + IntToString(AIWaveGetTimeInCombat(w)) +
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:83
if (eval < neededEval) {
if (AIWaveState(w) != c_waveStateRetreat) {
DebugAIPlayerWave(player, "self defend1 set wave = retreat to gather defense");
AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherD(player, c_townMain));
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:88
}
}
else if (AIWaveState(w) != c_waveStateDefend) {
if (eval > neededEval+10) {
if (AIWaveGetTimeSinceOrdered(w) >= 20) {
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:106
if (eval < neededEval) {
if (AIWaveState(w) != c_waveStateRetreat) {
DebugAIPlayerWave(player, "ally defend1 set wave = retreat to gather defense");
AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherD(player, c_townMain));
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:111
}
}
else if (AIWaveState(w) != c_waveStateDefend) {
if (eval > neededEval+10) {
if (AIWaveGetTimeSinceOrdered(w) >= 5) {
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:136
AIDefendAllyWithWave(player, w);
}
else if (AIWaveState(w) != c_waveStateIdle) {
DebugAIPlayerWave(player, "defend3 set defend = idle at gather defense");
AIWaveSetType(w, c_waveStateIdle, AIWaveTargetGatherMelee(player));
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:156
unit obstruction = null;
int count = AIWaveUnitCount(w);
int state = AIWaveState(w);
int attackState = AIState(player, e_attackState);
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:199
string leaderType;
state = AIWaveState(w);
if (type == c_waveDivert2) {
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:269
int state;
state = AIWaveState(w);
if (state != c_waveStateGuardHome) {
DebugAIPlayerWave(player, "home set divert = idle at gather defense");
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:284
unit oldTarget = null;
int obsLife;
int state = AIWaveState(w);
// If we're supposed to be obeying the player, merge back into the main wave
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:615
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1500
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/core.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:506
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:594
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactProtAI.galaxy:1501
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/starcoop/starcoop.sc2mod — base.sc2data/TriggerLibs/Tactical/TactTerrAI.galaxy:486
curWave = AIUnitGetWave(aiUnit);
if (curWave == null || AIWaveState(curWave) != c_waveStateRetreat) {
return null;
}
mods/warcoop/warclassicsystem.sc2mod — base.sc2data/TriggerLibs/Tactical/TacticalAIWar3.galaxy:84
w=AIUnitGetWave(aiUnit);
if(w==null){return null;}
if(AIWaveState(w)==c_waveStateRetreat){return null;}//For Fun
goal=AIWaveGoal(w);
if(goal==null){return null;}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:189
"wave=" + name +
", units=" + IntToString(AIWaveUnitCount(w)) +
", state=" + WaveStateName(AIWaveState(w)) +
", ratio=" + IntToString(AIWaveEvalRatio(w, c_evalRange)) +
", combat=" + IntToString(AIWaveGetTimeInCombat(w)) +
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:213
if (eval < neededEval) {
if (AIWaveState(w) != c_waveStateRetreat) {
DebugAIPlayerWave(player, "defend1 set wave = retreat to gather defense");
AIWaveSetType(w, c_waveStateRetreat, AIWaveTargetGatherD(player, c_townMain));
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:218
}
}
else if (AIWaveState(w) != c_waveStateDefend) {
if (eval > neededEval+10) {
if (AIWaveGetTimeSinceOrdered(w) >= 20) {
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:240
AIDefendWithWave(player, w);
}
else if (AIWaveState(w) != c_waveStateIdle) {
DebugAIPlayerWave(player, "defend3 set defend = idle at gather defense");
AIWaveSetType(w, c_waveStateIdle, AIWaveTargetGatherD(player, c_townMain));
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:252
unit obstruction = null;
int count = AIWaveUnitCount(w);
int state = AIWaveState(w);
int attackState = AIState(player, e_attackState);
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:292
string leaderType;
state = AIWaveState(w);
if (type == c_waveDivert2) {
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:358
int state;
state = AIWaveState(w);
if (state != c_waveStateGuardHome) {
DebugAIPlayerWave(player, "home set divert = idle at gather defense");
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:373
unit oldTarget = null;
int obsLife;
int state = AIWaveState(w);
// If we're supposed to be obeying the player, merge back into the main wave
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:495
}
if (AIWaveState(waveAttack) != c_waveStateAttack) {
return false;
}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:520
}
if (AIWaveState(waveAttack) != c_waveStateAttack) {
return c_nullPoint;
}
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/Orc/Orc.galaxy:428
//--------------------------------------------------------------------------------------------------
bool CaptainRetreating(int player){
return AIWaveState(AIWaveGet(player,c_waveMain))==c_waveStateRetreat;
}
void setup_forceOrc (int player){