• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Detect Damage event

Status
Not open for further replies.
Level 9
Joined
Dec 31, 2016
Messages
315
How can I detect whether a unit has taken damage from any source? There is only event "is atttacked" bit this fires immediatelly before actually taking any damage.

Thank you for help.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
I think the generic GUI event is missing still, but it is available.

call TriggerRegisterAnyUnitEventBJ( myTrigger, EVENT_PLAYER_UNIT_DAMAGING )
GetTriggerUnit() for who was damaged
GetEventDamageSource() for who did the damage

Using a DDS is still advisable.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Use the generic unit event that was added in 1.31.

Anyone claiming it does not exist either is using GUI, or is using a pirated version of Warcraft III so have not updated to 1.31.

1.31 added generic player events for taking damage as well as a new event which fires before damage is reduced by armor allowing the damage to be modified directly. However it did not added either events to GUI, meaning one has to use JASS/Lua directly to use them. If you can only use GUI then use a recently updated damage detection system and let that handle all the custom script work.

Do note that the community may stop calling these "DDS" seeing how they are not Direct Draw Surface textures which Warcraft III Reforged uses.
 
Level 9
Joined
Dec 31, 2016
Messages
315
Yes, I use GUI. I should probably learn Jass sometime, but I am just too lazy I guess. :d Also I don't really see why they didn't add it to GUI too. It already exists for specific so why not for generic.
 
Status
Not open for further replies.
Top