WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Changing spell sound effect? (https://www.wowinterface.com/forums/showthread.php?t=57908)

dfsdfvh 04-02-20 10:46 PM

Changing spell sound effect?
 
Title. I really like sub rogue’ Shuriken Storm sound effect, is there anyway for me ro replace Fan of Knives sound effect with Shuriken Storm', or maybe even any custom sound on my PC?
Thanks for your help :)

LudiusMaximus 04-03-20 01:27 AM

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)



All times are GMT -6. The time now is 07:38 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI