View Single Post
04-03-20, 01:27 AM   #2
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 321
As I have already told you , you could try to hook PlaySound() as described here: https://www.wowinterface.com/forums/...688#post325688

I have not tried it myself, but this is how I would go about it. First you write:

Code:
hooksecurefunc("PlaySound", function(...)
  local id, channel, forceNoDuplicates, runFinishCallback = ...
  print("PlaySound", id)
end)
This should print the sound id of any sound played.
Thus, you can note down the sound ids of Shuriken Storm and Fan of Knives.

Then you make a function above your hook function:
Code:
local function StopLastSound()
  -- Play some sound to get a handle.
  local _, handle = PlaySound(SOUNDKIT[next(SOUNDKIT)], "SFX", false)
  if handle then
    -- Stop this sound and the previous.
    StopSound(handle-1)
    StopSound(handle)
  end
end

And change your hook function to
Code:
hooksecurefunc("PlaySound", function(...)
  local id = ...
  
  if id == <Fan of Knives id> then
    StopLastSound()
    PlaySound(<Shuriken Storm id>)
  end
end)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote