Well, usually the idea is to create a local trigger, with the event EVENT_UNIT_DAMAGE and for the (Triggering Unit), and as a condition to make it so that only the attacker actually affects the unit. The only thing would be to give a time limit in which the unit can be damaged, because if not, if players abuse the EVENT_UNIT_ATTACKED delay then there will be dozens of leaks causing lag.
673 posts Sunny Singapore, the lil' red dot joined
#3
ok, now im confused. i use the EVENT_UNIT_DAMAGE to check that a unit is damaged? then what what do i use EVENT_UNIT_ATTACKED for? (sorry this is actually my first time trying out JASS)
Well, EVENT_PLAYER_UNIT_ATTACKED actually because it works for any unit. It's a generic event. Practically this technique makes EVENT_UNIT_DAMAGED generic as well. There may be other techniques to prevent the leaking but I never studied this problem in depth.