I've seen so many people tearing their hair out, attempting to find a way to do an Any Unit Takes Damage Event / trigger, for Counter Spells, Channel Breakers, Stun Negation, and many other great ideas. In turn, I myself was unable to find any real help on the topic. As most map developers who know how to do it keep it a secret for whatever reason - maybe not wanting to release their 200 line JASS code they slaved over. Im pretty new to the World Editor, and Ill show you a quick and easy way I've discovered to make a Any Unit Takes Damage Event / Trigger in a matter of seconds in the GUI.
This will allow you to poll you're hero's as units to validate them for Specific Unit Takes Damage. Its so easy, you'll probably be understandably livid when you realize its simplicity.
Easy Enough For Newbs
Lets get started...
First off, Create a map with a tavern and set the dependencies in the Advanced/Gameplay Constants for ALTAR to a circle of power you will create, owned by a player. Delete the Melee triggers, as they are useless at the time. Place some random creeps around to give you some damage.
I wont be adding any trigger spells here, so the only confirmation you'll have is text displays of your heros and how much damage each is taking. Add some actions after you get it built to play aroud with it.
The Triggers
Create two triggers, the First is your initialization trigger for allowing the Any Unit Takes Damage Trigger to work.
Initialization Trigger:
[simplest ever]
Events:
Map Initialization
Unit - A unit Enters (Entire Map)
Conditions: None
Actions: Unit Group - Pick Every unit in (Units in Playable Map Area) and do (Actions)
[loop actions]
Game - Display to (All Player) the Text: ((Name of (Picked Unit)) + Is Alive)
Trigger - Add to ***Name of Other Trigger Here*** the event (unit - (Picked unit) Takes Damage
This adds the events to the second trigger, every time a unit gets spawned, it recalculates the triggers - which the GUI Happily denied you of creating Simple Huh? You can add - in a IF for constraining heros, but I like to use creep-damage detection too.
2nd Trigger:
Events: NONE!
Conditions: NONE!
Actions: Game - Display to (All Players) the text: ((Name of (triggering unit)) + (String(Damage Taken))))
Thats pretty much it.. if you want, and I know you will. Many people might say it does nothing at all really - but consider the balance abilites - being able to see so easily all the damage that all units are taking - I add it every time im programming a new trigger - just to be sure the damage is not too extreme. Add some IF's and Actions for you're buffs or abilities you want to constrain the trigger spell for. You can now Freely use (Damage Taken) instead of Attacked Unit / "Wait for Life of attacked unit Less Than Variable"
You can use many other events besides the Unit Takes Damage to make extremely intuitive spells without quite as much line after line after line of validation. I used it for an ability for a Dragoon Knight to have a 20% Chance to block a percentage of the overall damage, regardless of type and Increasing Bounceback damage equal to the amount blocked (100% at level 50, because my maps are always 256x256 Rpg -style maps). The ability passively works against anything but aoe - making you wish you hadn't blasted Level 30 Meteor for 1200 mana just to see it bounce right back in you're face! haha.
I realize this is very simple, but so many people seem not to know how to do it. I know there's probably so many ways to go about it, but this way you dont need any variables or powerfull JASS, so it stays MUI and its so easy to create. Maybe im just super-noob and everyone knows how to do this, but I couldnt find any help on it.
This will allow you to poll you're hero's as units to validate them for Specific Unit Takes Damage. Its so easy, you'll probably be understandably livid when you realize its simplicity.
Easy Enough For Newbs
Lets get started...
First off, Create a map with a tavern and set the dependencies in the Advanced/Gameplay Constants for ALTAR to a circle of power you will create, owned by a player. Delete the Melee triggers, as they are useless at the time. Place some random creeps around to give you some damage.
I wont be adding any trigger spells here, so the only confirmation you'll have is text displays of your heros and how much damage each is taking. Add some actions after you get it built to play aroud with it.
The Triggers
Create two triggers, the First is your initialization trigger for allowing the Any Unit Takes Damage Trigger to work.
Initialization Trigger:
[simplest ever]
Events:
Map Initialization
Unit - A unit Enters (Entire Map)
Conditions: None
Actions: Unit Group - Pick Every unit in (Units in Playable Map Area) and do (Actions)
[loop actions]
Game - Display to (All Player) the Text: ((Name of (Picked Unit)) + Is Alive)
Trigger - Add to ***Name of Other Trigger Here*** the event (unit - (Picked unit) Takes Damage
This adds the events to the second trigger, every time a unit gets spawned, it recalculates the triggers - which the GUI Happily denied you of creating Simple Huh? You can add - in a IF for constraining heros, but I like to use creep-damage detection too.
2nd Trigger:
Events: NONE!
Conditions: NONE!
Actions: Game - Display to (All Players) the text: ((Name of (triggering unit)) + (String(Damage Taken))))
Thats pretty much it.. if you want, and I know you will. Many people might say it does nothing at all really - but consider the balance abilites - being able to see so easily all the damage that all units are taking - I add it every time im programming a new trigger - just to be sure the damage is not too extreme. Add some IF's and Actions for you're buffs or abilities you want to constrain the trigger spell for. You can now Freely use (Damage Taken) instead of Attacked Unit / "Wait for Life of attacked unit Less Than Variable"
You can use many other events besides the Unit Takes Damage to make extremely intuitive spells without quite as much line after line after line of validation. I used it for an ability for a Dragoon Knight to have a 20% Chance to block a percentage of the overall damage, regardless of type and Increasing Bounceback damage equal to the amount blocked (100% at level 50, because my maps are always 256x256 Rpg -style maps). The ability passively works against anything but aoe - making you wish you hadn't blasted Level 30 Meteor for 1200 mana just to see it bounce right back in you're face! haha.
I realize this is very simple, but so many people seem not to know how to do it. I know there's probably so many ways to go about it, but this way you dont need any variables or powerfull JASS, so it stays MUI and its so easy to create. Maybe im just super-noob and everyone knows how to do this, but I couldnt find any help on it.