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

[JASS] GetLastPlayedSound doesn't work?

Status
Not open for further replies.
Level 14
Joined
Dec 12, 2012
Messages
1,007
Hello,

I have a problem with the function GetLastPlayedSound, it just doesn't work when I want to use it in my code... Here is my trigger:

JASS:
function Trig_test_Actions takes nothing returns nothing

    if (GetLastPlayedSound() == gg_snd_HeroBladeMasterWhat1) then
        call DisplayTextToForce( GetPlayersAll(), "Soundcheck" )
    endif

endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_test, 0.02 )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction

The problem is, that this only works if I manually play the sound by another trigger, but not if I simply click on the unit and it says exactly the same sound... So I don't get the difference in here?

Greetings,
lfh
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
GetLastPlayedSound is not a native function, but a function from GUI. (blizzard.j).
Check how this function is done and you will understand.

How can I check this? I only found this and there the function just says return bj_lastPlayedSound...

You just can't get sounds which are played by the game without any trigger action.

Hm, this is sad :(
 
Status
Not open for further replies.
Top