We all want to detect damage dealed from any unit to any unit but it isn't as simple as many seems to think, even with these creations of new events. I suppose we want to use this with passive abilitis. There is difference in the ways depending on if the ability is needed by the attacker or the attacked. The big tricky thing in this is to really know if the attacker finnished its' attack or not and to get it work with evasion. I think that you can't make it work good in GUI, not at all. Skilled spellmaker correct me if I'm wrong.
Attacked needs ability (AntiOrb)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
I think the best way is to have a trigger detecting when a unit learns the ability and then create a local trigger detecting damage dealed to the attacked unit. Let this trigger lasts as long as the unit still has its' ability. (Check at every execution if the unit has it.) I have never tried this myself but I have seen that Vexorian uses this method in MagmaRage.
Attacker needs ability (Orb)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
This is far more trickier since there is no event detecting when a unit deals damage to another. I have never succeded making a such ability but tried. We can't do as above like detecting when a unit learns the ability and then make it a trigger since we can't detect when it deals damage. Here is as far as I got:
1. We need to detect an attack. Easy matter with the event.
2. We need to create a local trigger detecting damage dealed to the attacked unit. Which of course must destroy it self after it has detected any damage.
3. We must know if the attacker finnishes it's attack animation so that the damage is dealed. Just think if the attacker stops attacking before any damage is dealed. Then the trigger we just created will still exist there and detect any further damage dealed to the attacked unit and do its' actions no matter if the attacker has the correct ability or not since it will detect any damage deald to the attacked unit by any unit. And more bad, let's say the attacker does an unfinnished attack again. Then there will be two triggers detecting damage dealed to the attacked unit. So when a unit makes a succesfull attack, both these two triggers will detect the damage and execute their actions plus the new one create by the last succesfull attack. So totaly three triggers will be executed for one succesfull hit and two "misses". And note that if the attacked has evasion and aviods the attack this will also resoult in a new trigger. Avoided attacks isn't detected by damage detecting triggers even if the attack animation was finnished.
4. Now we are close to what I have been able to do. To detect if the attack animation was finnished we must make the damage detecting trigger also detect any action that could cause the attack to not finnish. We need to detect all types of orders given to the attacker and its' death (maybe some others as well). Then we must have an if template (hmm... or maybe a condition) to know which of the events was detected and only execute the actions if the detected event was damage detection. Still this will not solve the problem with evasion. I know no solution to that except simulate all evaison in this trigger.
If you have solutions to this please tell.
Attacked needs ability (AntiOrb)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
I think the best way is to have a trigger detecting when a unit learns the ability and then create a local trigger detecting damage dealed to the attacked unit. Let this trigger lasts as long as the unit still has its' ability. (Check at every execution if the unit has it.) I have never tried this myself but I have seen that Vexorian uses this method in MagmaRage.
Attacker needs ability (Orb)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
This is far more trickier since there is no event detecting when a unit deals damage to another. I have never succeded making a such ability but tried. We can't do as above like detecting when a unit learns the ability and then make it a trigger since we can't detect when it deals damage. Here is as far as I got:
1. We need to detect an attack. Easy matter with the event.
2. We need to create a local trigger detecting damage dealed to the attacked unit. Which of course must destroy it self after it has detected any damage.
3. We must know if the attacker finnishes it's attack animation so that the damage is dealed. Just think if the attacker stops attacking before any damage is dealed. Then the trigger we just created will still exist there and detect any further damage dealed to the attacked unit and do its' actions no matter if the attacker has the correct ability or not since it will detect any damage deald to the attacked unit by any unit. And more bad, let's say the attacker does an unfinnished attack again. Then there will be two triggers detecting damage dealed to the attacked unit. So when a unit makes a succesfull attack, both these two triggers will detect the damage and execute their actions plus the new one create by the last succesfull attack. So totaly three triggers will be executed for one succesfull hit and two "misses". And note that if the attacked has evasion and aviods the attack this will also resoult in a new trigger. Avoided attacks isn't detected by damage detecting triggers even if the attack animation was finnished.
4. Now we are close to what I have been able to do. To detect if the attack animation was finnished we must make the damage detecting trigger also detect any action that could cause the attack to not finnish. We need to detect all types of orders given to the attacker and its' death (maybe some others as well). Then we must have an if template (hmm... or maybe a condition) to know which of the events was detected and only execute the actions if the detected event was damage detection. Still this will not solve the problem with evasion. I know no solution to that except simulate all evaison in this trigger.
If you have solutions to this please tell.
