Unit takes damage event

Status
Not open for further replies.
Level 4
Joined
Nov 18, 2021
Messages
41
Hello, I've searched far and wide but can't seem to find this event.
What does this condition refers to then?
1638909112093.png
 
Level 4
Joined
Nov 18, 2021
Messages
41
Takes Damage is a "Specific Unit Event" not a generic. I believe this is one of the major reasons why something like Bribe's damage system is so valuable. It is able to keep track of all the units and their damage events.
why did devs do it like this??
Anyways. as I see, this specific event does not allow unit-type / unit with specific ability / all units / etc, instead I have to manually choose it on the map
Is there a way for me to not do that? I can, theoretically make a trigger literally for every unit in the map, but what if I have to pick a unit that will spawn from trigger/ability, for example?
 
Last edited:
Level 4
Joined
Nov 18, 2021
Messages
41
Ok, apparently even though it is not allowed to use variables in event, you can use them by adding them through trigger - add event
I have to spend some time polishing (auto-adding summoned units, among other things) this but it did figure out the killer properly
1638912045293.png

1638911967747.png

That's why Bribe's Damage Engine is so highly recommended. It handles all this for you and lets you use "generic" damage taken events in your triggers.

I reaaaallly don't wanna use stuff I don't understand and don't have time to learn coding rn

Ok, apparently even though it is not allowed to use variables in event, you can use them by adding them through trigger - add event
I have to spend some time polishing (auto-adding summoned units, among other things) this but it did figure out the killer properly
1638912045293.png

1638911967747.png


I reaaaallly don't wanna use stuff I don't understand and don't have time to learn coding rn
Well, that's worrying
Will try fixing it tommorow
1638912271058.png


Of course I can't sleep without at least making it not freeze.
This one works
1638913799405.png

1638913807164.png


1638914577338.png

And this one adds summoned units.
IDK man, this looks like a good alternative for importing damage engine.
Does anyone have any ideas about why it should be bad?
It finds a killer, but can be re-written to find who dealt damage and I don't require anything else.
 
Last edited by a moderator:
Level 25
Joined
Feb 9, 2009
Messages
1,797
Damage engine has a large number of options but you don't have to use them all.
Having it just within the trigger editor allows you to use the variables to do something like this:
  • Footman hurts footmen more!
    • Events
      • Game - Value or Real of Variable(DamageEvent) becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Footman
      • (Unit-type of DamageEventTarget) Equal to Footman
    • Actions
      • Set VariableSet DamageEventAmount = (DamageEventAmount x 1.50)
And Bribe himself still hangs out here to answer questions about it, as well as many other hive users that regularly use it, so if you have issues or questions they can help.

And based on your test trigger above you can use the "LethalEvent" to catch when a unit dies:
  • Example
    • Events
      • Game - LethalDamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Special Effect - Create a special effect at (Position of DamageEventSource) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
Just need to copy the test map's folder that says "Damage engine" (And shove the variable folder in there for good measure too.) into your trigger editor.
But be sure your preferences allow variable creation stuff:
1638926289635.png
1638926325813.png
1638926229861.png
 

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,277
To clarify something, you don't have to rely on a Specific Unit Event to detect damage. I think it was like that back in the day but not anymore.

We have generic damage events now but they're only accessible through code.

vJASS:
local trigger trig = CreateTrigger();
TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGING);
TriggerAddAction(trig, UnitDealtDamage);

local trigger trig = CreateTrigger();
TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGED);
TriggerAddAction(trig, UnitWasDamaged);
 
Status
Not open for further replies.
Top