# Wave Time In Combat
Grammar — How long the specified wave waveRef has been in combat
Flags —Native
|Function
Returns how long the specified wave has been in combat.
# Arguments
wave
— Wave
Returns — int
native int AIWaveGetTimeInCombat(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:61
", state=" + WaveStateName(AIWaveState(w)) +
", ratio=" + IntToString(AIWaveEvalRatio(w, c_evalRange)) +
", combat=" + IntToString(AIWaveGetTimeInCombat(w)) +
", safe=" + IntToString(AIWaveGetTimeSinceCombat(w)) +
", threat=" + threat
mods/core.sc2mod — base.sc2data/TriggerLibs/MeleeWaveAI.galaxy:535
distFriend = AIPathDistToNearestFriendlyStructure(player, leaderPos, true);
if (AIWaveGetTimeInCombat(w) > 0) {
// currently in combat
if ((distEnemy >= 0 )&& (distEnemy < distFriend)) {
mods/core.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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.sc2mod — base.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