• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

The new Event: A unit takes damage

Status
Not open for further replies.
Level 9
Joined
Jun 13, 2010
Messages
365
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 29
Joined
Sep 26, 2009
Messages
2,596
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 30
Joined
Aug 29, 2012
Messages
1,383
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