• 🏆 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!

[TRIGGER EVENT] DETECT WHEN ANY UNIT IS DAMAGED

Status
Not open for further replies.
Level 3
Joined
Jun 24, 2019
Messages
24
Hello everyone,

I read the 1.31 patch update log, and it said
now in world editor we can detect if any unit is damaged!

However, I tried quite hard and cannot find relevant available event in trigger editor. Could anyone help me with this? Thank you! :)

BTW, in specific unit event, it explicitly has one A unit is damaged and one A unit is attacked option separately. While in generic unit event, it only only has A unit is attacked option. And I already update to the lasted patch tho :(
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
I believe it has not yet been implemented into GUI, so it is only accessible via JASS custom script. If you wish to add this event to a trigger, you can put this simple library in your map's Custom Script section (click the map icon at the top left in the trigger editor and paste this in the window). Give the trigger no events at all, they will be added at map init by the library.
JASS:
library DamagedEventAdder initializer init
  private function init takes nothing returns nothing

    //change the name of the trigger to match the name of the trigger you want it added to
    //the format is: gg_trg_ + the name of the trigger with _ instead of spaces (see below)

    //if you change the name of the trigger in the trigger editor (or delete the trigger entirely) you will have to change it here
    //if you have multiple triggers that need this event you can duplicate the below line here for any number of triggers, just use the right name!

    call TriggerRegisterAnyUnitEventBJ(gg_trg_Your_Trigger_Name_Here, EVENT_PLAYER_UNIT_DAMAGED) 
  endfunction
endlibrary
 
Level 3
Joined
Jun 24, 2019
Messages
24
I believe it has not yet been implemented into GUI, so it is only accessible via JASS custom script. If you wish to add this event to a trigger, you can put this simple library in your map's Custom Script section (click the map icon at the top left in the trigger editor and paste this in the window). Give the trigger no events at all, they will be added at map init by the library.
JASS:
library DamagedEventAdder initializer init
  private function init takes nothing returns nothing

    //change the name of the trigger to match the name of the trigger you want it added to
    //the format is: gg_trg_ + the name of the trigger with _ instead of spaces (see below)

    //if you change the name of the trigger in the trigger editor (or delete the trigger entirely) you will have to change it here
    //if you have multiple triggers that need this event you can duplicate the below line here for any number of triggers, just use the right name!

    call TriggerRegisterAnyUnitEventBJ(gg_trg_Your_Trigger_Name_Here, EVENT_PLAYER_UNIT_DAMAGED)
  endfunction
endlibrary

Hello, thanks for your reply, but I wonder why it isn't like this?
vJASS:
call TriggerRegisterAnyUnitEventBJ(gg_trg_Your_Trigger_Name_Here, EVENT_UNIT_DAMAGED)

Can I know what's the difference between EVENT_PLAYER_UNIT_DAMAGED and EVENT_UNIT_DAMAGED?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Damage Engine 5.3.0.0

If all you're looking for is a damage detection system for your map then look no further than the link above.

Damage Engine's original purpose was to bring those new events to GUI, but it grew from there quite a bit. The new damage detection and modification enabled for JASS users is brought to GUI via the latest updates.

However, the simplest DDS around is definitely Weep's GDD, but that will become completely useless once (if) Blizzard bring DDS natives to GUI.

Even after the natives are brought to GUI, Damage Engine will still be - by far - the best choice for power users who want the most from their damage modification.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
4,994
Hello, thanks for your reply, but I wonder why it isn't like this?
vJASS:
call TriggerRegisterAnyUnitEventBJ(gg_trg_Your_Trigger_Name_Here, EVENT_UNIT_DAMAGED)

Can I know what's the difference between EVENT_PLAYER_UNIT_DAMAGED and EVENT_UNIT_DAMAGED?
I made a mistake in my above post and it should be EVENT_PLAYER_UNIT_DAMAGED. The one without player is for specific unit events and the player one is for generic unit events.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
This is obsolete by Warcraft III itself?

DDS is not available in GUI.

Damage Engine's original purpose was to bring those new events to GUI, but it grew from there quite a bit. The new damage detection and modification enabled for JASS users is brought to GUI via the latest updates.

However, the simplest DDS around is definitely Weep's GDD, but that will become completely useless once (if) Blizzard bring DDS natives to GUI.

Even after the natives are brought to GUI, Damage Engine will still be - by far - the best choice for power users who want the most from their damage modification.

I made a 1.31-optimized version today of GDD as well as PDD, the former adding only DDS while the latter only differentiating between spell and physical damage while offering basis damage modification.
 
Status
Not open for further replies.
Top