WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   UNIT_SPELLCAST_SUCCEEDED and multiple results (https://www.wowinterface.com/forums/showthread.php?t=56062)

doofus 02-23-18 03:33 AM

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?

Kanegasi 02-23-18 04:47 AM

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.

doofus 02-24-18 04:07 AM

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 ...


All times are GMT -6. The time now is 11:57 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI