Quantcast
UNIT_SPELLCAST_SUCCEEDED and multiple results - WoWInterface
Thread Tools Display Modes
02-23-18, 03:33 AM   #1
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
UNIT_SPELLCAST_SUCCEEDED and multiple results

I am using UNIT_SPELLCAST_SUCCEEDED to detect the spells that the player casts. I am not using the combat log.

I have noticed when I cast a spell, eg Frostbolt I receive two events, one when the spellcast is complete with event id 116, and another event when the spell hits with event id 228597. I presume this is for spells that can miss/resisted? Other spells, like Ice Lance only produce one and only event, as you'd expect.

If the second event is to notify me of a successful hit/miss/resisted and also of the travel time associated with some spells, then why do we not have a completely different event like "SPELL_HIT_MISS" or something similar?

How can an addon tell which events are the actual spell cast, and which are the result which due to travel time and due to hit/miss can have varying results?
  Reply With Quote
02-23-18, 04:47 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 500
That is the spell ID. Fifth argument of the event, correct?

http://www.wowhead.com/spell=116/frostbolt
http://www.wowhead.com/spell=228597/frostbolt

Looks like the game is confused and thinks you’re casting two spells at the same time. I don’t know the difference, so only check for one of them. In your code, just use a line like “if ID=116 then return end” and the code will ignore that spellcast.
  Reply With Quote
02-24-18, 04:07 AM   #3
doofus
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 138
Yes the "normal" Frostbolt is 116 and the subsequent event when the missile reaches the target is 228597. Since I only care about having cast the spell, and which spell, it is the first event which is of value.

I was hoping to find a better way of detecting "have I cast a spell successfully? and which spell?" rather than "has the missile travelled to the target and did it hit or miss?".

Of course I have filtered out the spells I do not care about, in this case 228597 and I hope they do not change the IDs ...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » UNIT_SPELLCAST_SUCCEEDED and multiple results

Thread Tools
Display Modes

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