• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

The new Event: A unit takes damage

Status
Not open for further replies.
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 26
Joined
Sep 26, 2009
Messages
2,425
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 21
Joined
Aug 29, 2012
Messages
889
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)
 
Status
Not open for further replies.
Top