# Wave Time In Combat

Grammar — How long the specified wave waveRef has been in combat
FlagsNative | Function

Returns how long the specified wave has been in combat.

# Arguments

  • wave — Wave

Returns — int

native int AIWaveGetTimeInCombat(wave w);

Category: AI Advanced / Waves / Functions

# Examples

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

        ", state="      + WaveStateName(AIWaveState(w))                 +
        ", ratio="      + IntToString(AIWaveEvalRatio(w, c_evalRange))  +
        ", combat="     + IntToString(AIWaveGetTimeInCombat(w))         +
        ", safe="       + IntToString(AIWaveGetTimeSinceCombat(w))      +
        ", threat="     + threat

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

    distFriend = AIPathDistToNearestFriendlyStructure(player, leaderPos, true);

    if (AIWaveGetTimeInCombat(w) > 0) {
        // currently in combat
        if ((distEnemy >= 0 )&& (distEnemy < distFriend)) {

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

        if (AIGetFlag(player, e_flagsAllowRetreat) && !AIGetCoopFlag(player, c_coopWaveAttacker)) {
            // 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

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

        ", state="      + WaveStateName(AIWaveState(w))                 +
        ", ratio="      + IntToString(AIWaveEvalRatio(w, c_evalRange))  +
        ", combat="     + IntToString(AIWaveGetTimeInCombat(w))         +
        ", safe="       + IntToString(AIWaveGetTimeSinceCombat(w))      +
        ", threat="     + threat

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

    distFriend = AIPathDistToNearestFriendlyStructure(player, leaderPos, true);

    if (AIWaveGetTimeInCombat(w) > 0) {
        // currently in combat
        if ((distEnemy >= 0 )&& (distEnemy < distFriend)) {

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

        if (AIGetFlag(player, e_flagsAllowRetreat) && !AIGetCoopFlag(player, c_coopWaveAttacker)) {
            // 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