• 🏆 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!

Unpause Event

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
I wonder does this system work for everyone? The system name is very self explanatory. There are some requirements to make it work tho. Read in documentation.

Code:
JASS:
library UnpauseEvent initializer init
   
    /*
                      Unpause Event v1.1
       
        Provides unpause event which fires a moment after
        the game is paused. This is only a workaround that
        means it has several cons:
            - Can't detect "quick" pause event
            - Requires sound effect enabled (in option menu)
            - Requires working sound system (available sound device)
            - Requires a sound file (6 KB)
           
        User API
            1. Add the unpause event to your own trigger
                | function TriggerRegisterUnpauseEvent takes trigger trig returns nothing
           
            2. Register a function to the unpause event
                | function RegisterUnpauseEvent takes code func returns triggercondition
               
            3. Remove a function from the unpause event
                | function RemoveUnpauseEvent takes triggercondition whichCondition returns nothing
               
        How to import
            1. Copy UnpauseEvent trigger
            2. Import the sound file (PauseChecker.mp3) to your map
            3. Edit the FILE_PATH below if necessary
           
    */
   
    globals
        private constant real CHECK_INTERVAL = 0.05 // Pretty much needless to change
        private constant string FILE_PATH = "war3mapImported\\PauseChecker.mp3"
        private real Trigger  = 0
        private trigger Eval  = CreateTrigger()
        private timer Checker = CreateTimer()
        private sound Sound
        private boolean Available
    endglobals
   
    function TriggerRegisterUnpauseEvent takes trigger trig returns nothing
        call TriggerRegisterVariableEvent(trig, SCOPE_PRIVATE + "Trigger", EQUAL, 1)
    endfunction
   
    function RegisterUnpauseEvent takes code func returns triggercondition
        return TriggerAddCondition(Eval, Condition(func))
    endfunction
   
    function RemoveUnpauseEvent takes triggercondition whichCondition returns nothing
        call TriggerRemoveCondition(Eval, whichCondition)
    endfunction
   
    private function check takes nothing returns nothing
       
        if (Available) then
            if (not GetSoundIsPlaying(Sound)) then
                set Trigger = 1
                set Trigger = 0
                call TriggerEvaluate(Eval)
            else
                call StopSound(Sound, false, false)
            endif
        endif
        call StartSound(Sound)
        set Available = GetSoundIsPlaying(Sound) // Check if sound effect is enabled
        call TimerStart(Checker, CHECK_INTERVAL, false, function check)
       
    endfunction
   
    private function preload takes nothing returns nothing
       
        call StartSound(Sound)
        if (GetSoundIsPlaying(Sound)) then // Keep preloading until the sound is ready
            set Available = false
            call StopSound(Sound, false, false)
            call TimerStart(Checker, CHECK_INTERVAL, false, function check)
        else
            call TimerStart(Checker, CHECK_INTERVAL, false, function preload)
        endif
       
    endfunction
   
    private function init takes nothing returns nothing
   
        set Sound = CreateSound(FILE_PATH, false, false, false, 0, 0, "")
        call TimerStart(Checker, 0, false, function preload)
       
    endfunction
   
endlibrary
 

Attachments

  • UnpauseEvent v1.1.w3m
    21 KB · Views: 52
Level 17
Joined
Apr 27, 2008
Messages
2,455
If i remember correctly, if you cut off the sound on the wc3 setting, sounds won't be played at all and then that won't work.

EDIT : Ok, my bad, just read your comment.

And that will be probably the same if a player is on a multiplayer session and have its wc3 minimized.
But here i guess it's a pro.

Btw, just saying, camera updates won't be applied if a player has its warcraft 3 minimized.
I know it, since i've made a script to detect if it's the case for a player.

So maybe dracolich exploit (or whoever found it) is the way to go.
 
Last edited:

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
And that will be probably the same if a player is on a multiplayer session and have its wc3 minimized.
But here i guess it's a pro.
Yes, the game is not paused when minimized on multiplayer so the event won't fire.

This is just work around which has plenty of weaknesses yet to be found. But at very least it doesn't require hack stuffs.
I'm planning to use this to fix stuck release event bug in most arrow key systems. So I believe they will prefer non-hack complementary systems too.
 
Status
Not open for further replies.
Top