[LUA ADDON] Fatality script
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!