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

The new Event: A unit takes damage

Level 8
Joined
Jun 13, 2010
Messages
344
Now you can select the event A unit takes damage. I first realize this now.

However, as I am new to this feature, how do I prevent it from crashing?

Untitled Trigger 001
Events
Unit - A unit Takes damage
Conditions
Actions
Set VariableSet Unit = (Damage Target)
Set VariableSet Unit1 = (Damage source)
Unit - Cause Unit to damage Unit1, dealing 50.00 damage of attack type Spells and damage type Normal

The attacker takes 50 damage when the attacker deals damage to the target. However this will make it crash as it loops. How do I prevent this from triggering itself endlessly?

ALSO, this only affects damage taken. Can i make it affect healing somehow? Or do i just make an ability deal 1 damage and cause it to go through damage trigger and then heal?
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
turn off (this trigger)
deal dmg
turn on (this trigger)

Edit: as for healing - I don't think you can. Heals don't do negative dmg to units, so it will not fire the 'Unit Takes damage' and 'Unit is about to take damage' events.
I think you would need to completely write your own healing spells, but then again at that point you would not need to fire the damage events.
 
Last edited:
Level 20
Joined
Aug 29, 2012
Messages
831
Place a dummy unit somewhere on the map and have it deal the damage instead, that way you avoid the infinite loop

Alternatively, you also have this new handy function as a workaround:
  • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) + 50.00)
 
Top