• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Waits sometimes skippable by pausing the game?

Status
Not open for further replies.
Level 4
Joined
Jul 29, 2011
Messages
44
(I hope this is the right place to post this)

Several months back, a speedrunner found a strange thing in the first chapter of reign of chaos human campaign: if you pause the game by opening the menu or alt-tabbing on the frame when the quest is completed, the 5 second wait that should happen immediately afterwards is skipped. You can see it in his video at 1:25. Since then, me and one other sppedrunner managed to replicate it.


The relevant trigger in the map is this one:

  • Trigger Victory
    • Events
      • Unit - A unit owned by Player 1 (Red) dies
    • Conditions
      • (All units of WarlordAndCrewGroup are dead) equals TRUE
      • GAMEOVER equals FALSE
    • Actions
      • Set GAMEOVER = TRUE
      • Trigger - Run Next Level Prep <gen> (ignoring conditions)
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off Defeat <gen>
      • Unit - Make Arthas Invulnerable
      • Trigger - Run Turn off quests <gen> (ignoring conditions)
      • Wait 1.00 seconds
      • Quest - Flash the quest dialog button
      • Quest - Mark QuestOrcs as completed
      • Quest - Mark RequirementVillageSlay as completed
      • Quest - Mark RequirementVillageArthas as completed
      • Quest - Display to AAAPG_Arthas the Quest completed message: |cffffcc00MAIN ...
      • Wait 5.00 seconds // This is skipped in the video
      • Trigger - Add Victory <gen> to the trigger queue (ignoring conditions)

I was unable to reproduce it in my own map, so I'd like to ask if anyone here knows what could make this specific wait skippable.

edit: added trigger tags
 
Last edited:
The wait you want is either a timer or wait game-time seconds aka polled wait because the other one/s ignores paused states.

[jass=]
function PolledWait takes real duration returns nothing
local timer t
local real timeRemaining
if (duration > 0) then
set t = CreateTimer()
call TimerStart(t, duration, false, null)
loop
set timeRemaining = TimerGetRemaining(t)
exitwhen timeRemaining <= 0
// If we have a bit of time left, skip past 10% of the remaining
// duration instead of checking every interval, to minimize the
// polling on long waits.
if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
call DestroyTimer(t)
endif
endfunction[/code]
 
Waits, also called TriggerSleepAction reflects on computer time, not game-time. In this sense, if the game is paused, the computer is still running and the result is the trigger will still execute, unlike timers, which are based on game-time.

There was a thread (a tutorial on timers) that stated that waits persist when the game is paused, again unlike timers, which are paused when the game is paused.

In that sense, the trigger above should work as expected.
 
Status
Not open for further replies.
Top