[General] Detect if unit is killed by specific ability?

Status
Not open for further replies.
Level 27
Joined
Dec 3, 2020
Messages
891
How can I detect if a unit is killed by a specific ability, such as Firebolt for example?
I want to heal the caster/killing unit whenever the target unit of the ability dies by the ability and the ability only!

Edit: perhaps I can use dummy units?
 
Level 27
Joined
Dec 3, 2020
Messages
891
You can also make the ability deal for example -100 damage and then use a condition to check if the damage dealt is -100 and then set the damage to the correct value and run your actions.
Interesting! I shall tinker with some things.
So the scenario will be: orc warlock uses Firebolt, if target dies by Firebolt then heal the warlock and his summon.
The warlock can summon either a fel beast, succubus or a voidwalker.
I already use a unit indexer and linked the summons to their warlock with custom values and stuff.
For example: when a warlock dies, his summon will also die (this already works). Perhaps I can use this linking system, or whatever you wanna call it, to my advantage with this problem that I am facing.

It's not just a set number of warlocks since the player (and the AI) will train new orc warlocks, so that's why I use the unit indexer to make the link between each individual warlock and his summon.

PS: what about spell damage reduction? Will the condition still pass for example if the ability targets a hero?
 

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,098
PS: what about spell damage reduction? Will the condition still pass for example if the ability targets a hero?
If you have factors that might affect the actual damage values then the case becomes a little more complex, but still manageable. If for example the Orc Warlocks have no other way to deal negative damage (than the Fire Bolt) you can check if the damage source is a Orc Warlock and that the damage is below 0. That would mean that the damage was dealt by the Fire Bolt and thus you have it covered, regardless if the damage was reduced by 50% or went through as if it was not reduced.

I think you might also be able to use the "is about to take damage" event, which might be able to return the value of the damage before it would be reduced, which would simplify the approach.
 
Status
Not open for further replies.
Top