WC3 Modding Information Center

Warcraft (WC3) Modding => WC3JASS.com => Triggers & Scripting => Coding Help => Topic started by: NaughtySmurf on June 22, 2015, 12:34:17 PM

Title: Detecting Overdamage
Post by: NaughtySmurf on June 22, 2015, 12:34:17 PM
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 :)

EDIT: Cannot remove my own post. I know how it's done. /thread
Title: Re: Detecting Overdamage
Post by: moyack on July 11, 2015, 11:17:04 AM
Just for information for other users, this can be done with a damage detection system or giving a good use of GetEventDamage function, with the event TriggerRegisterUnitEvent.
Title: Re: Detecting Overdamage
Post by: NaughtySmurf on July 25, 2015, 05:57:00 AM
Since you are talking about Damage Detection. I think it is so hard to decide which one to use because there are so many out there, and some are not finished or just not effective anymore. Could you recommend a decent one? I'm looking for a system with the possibility of a little customization (like damage block, different damage types detected) but also don't want to create 10 abilities myself and look for 5 different libraries to make it work.