Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-25-12, 01:38 PM   #1
indoviet
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jan 2009
Posts: 8
Event question: SPELL_CAST_SUCCESS

Hi I'm a newbie addon developer and I'm running into some trouble understanding the SPELL_CAST_SUCCESS event. I wrote a short block of code that is supposed to detect when a specific spell is casted and then trigger a cooldown frame I set up. However, the event only triggers when the spell casted is an instant cast spell such as Corruption or Drain Soul. When I successfully cast a casted spell like Haunt or Shadow Bolt, the event doesn't trigger.

Can someone help me understand why SPELL_CAST_SUCCESS doesn't work for casted spells and what event I should be using instead?

Here is my code for reference:
Code:
function DispelBar_OnEvent(event,...)	
	local timeStamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = select(1,...)
	
	if(event=="SPELL_CAST_SUCCESS") then
		local spellName = select(13,...)
		print("SPELL_CAST_SUCCESS"..": "..spellName)
		if(spellName == "Haunt") then
			CooldownFrame:SetCooldown(GetTime(), 10)
		end
	end
end
In this example if I changed
Code:
if(spellName == "Haunt")
to an instant cast spell like
Code:
if(spellName == "Corruption")
then it works.

Thanks for all help in advance and let me know if I need to clarify anything.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Event question: SPELL_CAST_SUCCESS


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off