• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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