# Detecting Overdamage

Status
Not open for further replies.

#### NaughtySmurf

Level 2
Is there a way to detect the amount of damage that a spell or attack does beyond the lethal part?
Example: Spell does 300 damage. Target has 100 life and no damage reduction towards spell damage. Difference is 200, this is what I need.
In a scenario where units have different damage reductions this will be kind of complicated.
I was thinking about dealing a little damage (A), getting the actual damage done (B) and calculating the reduction from the quotient (A-B) / A. Then one could calculate the damage needed to kill this unit and thus get the difference. I wonder if there's a more efficient way though, because these seems rather complicated. Help please

#### SAUS

Level 12
This is a piece of cake with a damage detection system. It tells you how much damage they are about to take (after all forms of resistance / protection) and you can just compare that with remaining life.

#### NaughtySmurf

Level 2
I used the (admittedly GUI) dds from this website and it doesn't work like that. If a unit dies, it still gives me the total damage done, not the damage needed to kill the unit. So it's different for other systems?

EDIT: I have the feeling that I didn't explain it good enough. Here's a proper example: I have a spell that deals 500 damage. The target has 300 life and 30% resistance to the spell's damage and attack type. So it deals 500*0.7=350 damage. It kills the unit. What I want is the damage which exceeds the lethal amount: 350-300=50 damage

EDIT: Nevermind, I had a huuuge brain lag. You are so right

#### Dr Super Good

Spell Reviewer
Level 63
Just to clarify why it was the solution. The "Unit takes damage" event fires before the damage that triggered it is removed from the unit's life. Hence one can tell if the damage is fatal if the event response damage is greater than their current life minus 0.505 (the fatal threshold?).

It is possible for a unit to die from damage less than its current life due to the fatal threshold. It is important that you factor it in to any calculations involving death.

Last edited:

#### NaughtySmurf

Level 2
Ok, that's good to know. It actually was working with the dds I used, just had a major error in reasoning. Thank you both!

Status
Not open for further replies.

Replies
4
Views
3K
Replies
4
Views
2K
Replies
12
Views
1K
Replies
6
Views
877
Replies
19
Views
2K