View Single Post
03-06-18, 12:14 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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:
local f = CreateFrame("Frame")
f:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
f:SetScript("OnEvent", function(self, event, unit, spellName, _, lineID, spellID)
	if spellID == 192657 then
		DEFAULT_CHAT_FRAME:AddMessage(string.format("%s was cast!", GetSpellLink(spellID)))
	end
end)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote