# Wave Eval Ratio
Grammar — Eval ratio of the specified wave waveRef against enemies within range range
Flags —Native
|Function
Returns the eval ratio of the specified wave against enemies within the specified range.
# Arguments
wave
— Wavefixed
— Range
Returns — int
native int AIWaveEvalRatio(wave w, fixed range);
# 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:60
", units=" + IntToString(AIWaveUnitCount(w)) +
", state=" + WaveStateName(AIWaveState(w)) +
", ratio=" + IntToString(AIWaveEvalRatio(w, c_evalRange)) +
", combat=" + IntToString(AIWaveGetTimeInCombat(w)) +
", safe=" + IntToString(AIWaveGetTimeSinceCombat(w)) +
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:71
//--------------------------------------------------------------------------------------------------
void AIDefendSelfWithWave (int player, wave w) {
int eval = AIWaveEvalRatio(w, c_evalDefendRange);
int staticPercent = AILastWaveEvalStaticRatio();
int neededEval = 50;
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:102
//--------------------------------------------------------------------------------------------------
void AIDefendAllyWithWave (int player, wave w) {
int eval = AIWaveEvalRatio(w, c_evalDefendRange);
int neededEval = 30;
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:249
}
}
else if (AIWaveEvalRatio(w, c_evalHarassRange) < 100) {
if (state != c_waveStateRetreat) {
DebugAIPlayerWave(player, "set divert = retreat to harass point");
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:357
waveAtck = AIWaveGet(player, c_waveAttack);
countAtck = AIWaveUnitCount(waveAtck);
evalAtck = AIWaveEvalRatio(waveAtck, c_evalRange);
if (countAtck > 0 && evalAtck < 90) {
return false;
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:671
// retreat logic
time = AIWaveGetTimeInCombat(w);
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval >= 75 && eval <= 85 && time <= 3) { // when not fighting and only a little weak
if (AIGetFlag(player, e_flagsRunScared)) { // need to add check for ranges & max eval
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:698
else if (state == e_attackState_DropAttack) {
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval < 60) { // need to add check for can we retreat successfully
AISetAttackState(player, e_attackState_DropRetreat);
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:711
else if (state == e_attackState_Scared) {
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval > 90) { // turn and fight when strong
AISetAttackState(player, e_attackState_Attack);
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:190
", units=" + IntToString(AIWaveUnitCount(w)) +
", state=" + WaveStateName(AIWaveState(w)) +
", ratio=" + IntToString(AIWaveEvalRatio(w, c_evalRange)) +
", combat=" + IntToString(AIWaveGetTimeInCombat(w)) +
", safe=" + IntToString(AIWaveGetTimeSinceCombat(w)) +
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:201
//--------------------------------------------------------------------------------------------------
void AIDefendWithWave (int player, wave w) {
int eval = AIWaveEvalRatio(w, c_evalDefendRange);
int staticPercent = AILastWaveEvalStaticRatio();
int neededEval = 50;
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:338
}
}
else if (AIWaveEvalRatio(w, c_evalHarassRange) < 100) {
if (state != c_waveStateRetreat) {
DebugAIPlayerWave(player, "set divert = retreat to harass point");
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:440
waveAtck = AIWaveGet(player, c_waveAttack);
countAtck = AIWaveUnitCount(waveAtck);
evalAtck = AIWaveEvalRatio(waveAtck, c_evalRange);
if (countAtck > 0 && evalAtck < 90) {
return false;
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:757
// retreat logic
time = AIWaveGetTimeInCombat(w);
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval >= 75 && eval <= 85 && time <= 3) { // when not fighting and only a little weak
DebugAI("case1");
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:791
else if (state == e_attackState_DropAttack) {
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval < 60) { // need to add check for can we retreat successfully
AISetAttackState(player, e_attackState_DropRetreat);
mods/warcoop/warmeleeai.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:804
else if (state == e_attackState_Scared) {
eval = AIWaveEvalRatio(w, c_evalRange);
if (eval > 90) { // turn and fight when strong
AISetAttackState(player, e_attackState_Attack);