I recently found out there’s a script you can run to play certain soundtracks by inputting the sound ID into the macro. This made me think “maybe this works with NPC dialogue too”
I found someone who made a script like this to play a sound from a short list whenever their legendary weapon ability procs:
#showtooltip 16
/run local xx = {222586,234644,234138,234657,234026,234665} if GetItemCooldown(206448) == 0 then PlaySound( xx[ math.random( #xx ) ] ) end
/use 16
If someone could break down what each of the things in that script means, I would really appreciate it. I want to modify it so that instead of a weapon proc, it’s just a spell cast. I play a void elf rogue so I like the idea of the old gods whispering to me while fighting, and want to do something like /cast Deathmark, and then it will randomly pick from a list.
Here’s the list I have right now:
“You will be alone in the end” (564870)
“They are coming for you” (564858)
“Trust is your weakness” (564856)
“Kill them all before they kill you” (564877)
I would also like to add more sound files to this if the character limit allows
xx = {222586,234644,234138,234657,234026,234665}
the list of Sound IDs
if GetItemCooldown(206448) == 0 then
Check to see if Fyr’alath is off CD.
https://www.wowhead.com/item=206448/fyralath-the-dreamrender
Those and the /use 16
for whatever you want to cast, are the only parts you should need to modify.
In TWW to check a Spell CD C_Spell.GetSpellCooldown()
; item CD C_Container.GetItemCooldown
https://warcraft.wiki.gg/wiki/API_C_Container.GetItemCooldown
https://warcraft.wiki.gg/wiki/API_C_Spell.GetSpellCooldown
so would the script look something like this?:
#showtooltip Deathmark
/run local xx = {564870,564858,564856,564877} if C_Spell.GetSpellCooldown(360194) == 0 then PlaySound( xx[ math.random( #xx ) ] ) end
/use Deathmark
I can’t test it atm since the game is down for maintenance, but I would also be interested to see if there is a weakaura for this so I am not restricted by the character limit, and can add more files.
edit: I’m also unsure if I even need the GetSpellCooldown, because isn’t that what the #showtooltip is for? I only want the ability to make a sound when I successfully cast it
Yup. You don’t need Deathmark
after #showtooltip
though, it’ll pull from the cast.
#showtooltip
/run local xx = {564870,564858,564856,564877} if C_Spell.GetSpellCooldown(360194) == 0 then PlaySound(xx[math.random(#xx)]) end
/cast Deathmark
1 Like
Thank you so much! Will this also work in a WeakAura so I can add more sound files? or is the script different there? I have never made a weakaura before, only ever downloaded other people’s
thank you! I’m excited to try it out when maintenance is over.
another edit (sorry):
Can I ask one more question? Does this part of the script make it so it only plays the sound once when the ability is successfully cast? I originally thought this chunk of script would make it play the sound when the CD was over, not when you actually cast the ability.
So after some testing, I was able to get a macro working for the most part that looks like this:
#showtooltip
/run local xx = {38785,38781,38782,38780,38765,38769,8580,8581,143631,143558,131816,131814,14378,14373,14376,14372,124657,131822} if C_Spell.GetSpellCooldown(360194) == 0 then PlaySound( xx[ math.random( #xx ) ] ) end
/cast Deathmark
The only problem is that if you press the button and the ability does not successfully cast, the audio will still play. The audio will not play after subsequent presses when Deathmark is on cooldown, but I was hoping to have the audio only play once when the cast is successful. Is there any way to do this?