Hello! I'm trying to implement in my addon/UI a simple announcer that writes in party when a fatality (on me) occours.
I basically listen to the combat log and when a spell, or a dot, or a melee swing does damage greater or equal to the current health, it writes in party the amount of damage and the type of it (spell/dot/swing)
I tested it in duel and it seems to work, specially when I repeat the duel over and over again without re-fulling the health, so the first spell I use is the "killer" one.
Tested with Engi Gloves, various class spell, melee swings and dot. All work as intended.
However, when I'm in arena (the real reason why I made the script: for arenas), it triggers some false positives and I don't know why. For example it says "killed by 3000 damage of Mortal Strike" but I'm still alive! Maybe low health but still alive.
Or most of the times, when I REALLY die, it shows at least 2-3 spells even more, yesterday it showed a Heroic Strike + Execute + Frost Strike (MH) + Frost Strike(OH), in the same exact moment, i checked the time on the chat and the difference was 1 second. The total amount of these 4 spells was around 9k.
So why this behaviour, shouldn't I have only 1 spell that kills me? Why multiple ones trigger the script? I don't understand ....
I use eventtype == "SWING_DAMAGE"/"SPELL_DAMAGE"/"SPELL_PERIODIC_DAMAGE" and then extract the amount of damage from the 9th and 12th parameters, and I compare it to UnitHealth("player") to see if it's bigger or equal. If yes, the announce in party is fired.
Any help about this multiple announce firing?
Thanks!
I found the problem. And it's almost impossible to do what I want.
Basically, this is the game thinking:
1) You have 1100 Health
2) You take 600 Damage
3) Your Health drops to 400 Health
4) 600 is greater than 400 so the damage would kill you
5) Announce in chat that 600 is the damage that killed you
You see where the problem is? Point number 4.
The game did not compared the damage received with the health you had the moment the spell was cast (1100), but it compares the damage to the health you have the moment the spell damages you, which is 400.
In slow motion it would be
1) You have 1100 Health
2) You take 600 damage
3) There should be a small period of time where your health doesn't drop but you already received the damage, in this case the damage is 600 and the health is 1100
4) 600 isn't greater than 1100 so it isn't the Fatality spell
In few words: there should be a small delay between the damage received and the health actually dropping.
I don'tn think there is a "fix" to this so idk close the topic or delete it.
Can't you register a hit and instead of checking damage taken vs current HP (which is ofc wrong, you can have 15k, take 9k hit, have 6k remaining and then 6<9 and print useless message), try this:
-register a hit like you did
-use https://wowwiki.fandom.com/wiki/API_UnitIsDead
-if it returns true means you died on that spell. Hopefully it'll show just the last hit.
Also, MPR already reports killing blows in raids, you could try and scroll through their code to check that, but even that sometimes reports different things depending on specific player's latency and which hit he registers first. Sometimes my MPR would tell me PlayerA killed it and I'd see in /ra someone else's MPR saying it's PlayerF.
Though I realized the addon is not even so bad, because I can die by a 300 dmg rupture tick, but before I maybe got 6k lava burst 5k chain lightning so having multiple entries of the last seconds before my death could also help me realizing what I could do better (los/spell reflection) cuz clearly is not the rupture tick that dropped my health. So I don't know, I may stick with this version, gives me a wider vision of what happened in total.
Then consider this:
-register a hit as you do already
-if you're not dead after the hit landed add it to some stack/queue/list/array whatever, if there's more than 4 items in the list remove one and add this one.
-otherwise if you died by that hit print out the list (previous hits before that) and then print the killing blow.
But this is already available in Skada at least, recount has deaths, idk if it has a list of spells and times.