View Single Post
03-06-18, 01:13 AM   #3
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
Originally Posted by Phanx View Post
You can't detect when a specific sound is played (unless it was played by the UI code or an addon) but you can detect when a spell is cast.

Try this:
Code:
-- Phanx' code
Hi Phanx,

Just tried your approach and seems like this particular spell cannot be tracked that way :/
I also attempted printing all those succeeded spells' name and id, but no luck...

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
  3. f:SetScript("OnEvent", function(self, event, unit, spellName, _, lineID, spellID)
  4.     print(spellName, spellID); -- Still not printing for Bag of Tricks (192657) nor for Poison Bomb (192660)
  5.  
  6.     --if spellID == 192657 then
  7.     --  DEFAULT_CHAT_FRAME:AddMessage(string.format("%s was cast!", GetSpellLink(spellID)))
  8.     --end
  9. end)
  Reply With Quote