# Wait For Condition With Maximum Duration

Grammar — Wait for (Conditions), checking every t timeType|Real/Game/AI Time seconds, for no longer than maxDuration seconds
FlagsSubFunctions | Action

Pauses a trigger until the specified condition is met. The pause will last no longer than Max Duration seconds. Real time is normal time. Game time can pass faster or slower depending on the game speed. AI time passes at the same rate as game time, but can be paused or unpaused while real time and game time are still running. It is useful to pause the AI time while a player is watching a cinematic, so timed attack waves will wait until the player is finished with the cinematic before resuming their countdowns.

# Arguments

  • fixed — Time
  • int [ preset::TimeType ] — Time Type
  • fixed — Max Duration

Returns — void

#AUTOVAR(at,fixed) = 0;
while (!(#SUBFUNCS(cond," && ")) && #AUTOVAR(at) <= #PARAM(maxDuration)) {
    Wait(#PARAM(t), #PARAM(timeType));
    #AUTOVAR(at) = #AUTOVAR(at) + #PARAM(t);
}

Category: General / Waits

# Examples

— None found —