Could you please do it and upload the spellInvulnerable units can be attacked and this is easy to detect, though the attacks deal no damage, which means that you need to deal the damage by SetUnitState instead, and if the new life value is below 0.405 (or 0), then just remove the invulnerability and deal the actual damage from its source. Thus the solution consists of three parts:
A) Detecting when an invulnerable unit is attacked - this can be done through checking for example by buff (such as Divine Shield) if there's specific source of invulnerability you want to be affected, or by BlzIsUnitInvulnerable() function.
B) Dealing with the attack's damage by calling the Unit is about to take damage -event and change the target unit's life value by SetUnitState() function. If the new life value is below 0.405, then you'd want the damage source to kill the unit for real to allow bounty and experience gain (along the other factors).
C) Enabling units to attack invulnerable targets - this can be done through the SetUnitWeaponIntegerField() function. To find the correct integer value to enable the attacks against invulnerable units, I'd recommend using the call GetUnitWeaponIntegerField() function on a unit type that can by default target invulnerable units - for example a melee unit that can attack invulnerable units has integer value of 3146042 in the mentioned integer field.
Do you mean there's no way to create a spell could do itPls further tell more exactly what you mean, because description is quite scarce. Nobody is able to attack invulnerable units. The only way for you is to create your enemy's Divine Shield and ability to beat it - based on another ability, for example - Metamorphosis - you need just to create alternate version of your enemy with divine type of armor and modified versions of Hardened Skin and Anti-Magic Shell abilities that will prevent him from taking any damage. Then when you activate your Anti-Divine Shield ability you remove Hardened Skin and Anti-Magic Shell buff from enemy by trigger and transform your hero to the same version of himself, but with chaos attack which is able to penetrate divine armor. Con of this method - all other units also will be able to attack your enemy, but the only of them who has chaos attack will be capable to deal some significant damage to him. I hope I understood you correctly and it will be useful for you. The other alternate much more simple, but less versatile method - you can damage invulnerable units by dispel magic if they are summoned
This event fires just fine, even on invulnerable targets and returns the correct damage value.You can't detect when an invulnerable unit is attacked using the normal events, since the order to issue the attack is interrupted and the "attacK" Event never happen.
I think I don't have it in me to create the spell in GUI and I do not know which code language you use in your map.Could you please do it and upload the spell
I understand, I just wanted to clarify that "attacked" and "takes damage" are two different things.This event fires just fine, even on invulnerable targets and returns the correct damage value.
Unit - A unit About to take damage
I think I don't have it in me to create the spell in GUI and I do not know which code language you use in your map.