Ironically this is super easy in SC2 as it is the fundamentals of their standard armor system.
Anyway you will need some form of damage detection and prevention system. Damage prevention is not easy as the event fires before the damage is dealt but after the damage is going to be dealt. This means you cannot simply refund X health as you would cause the unit's life to overflow its maximum and so the damage would not be reduced. You also cannot use a 0 delay timer before refunding as then it is possible the damage will take the unit past the point of death before you can refund it with the blocked damage. As such you need to dummy heal to some value of life to absorb the incoming damage and then after a 0 second timer you need to correctly apply the life for the damage taken. However this is also not straight forward as a 0 second timer can allow for more than 1 damage to occur so you need to track all of them and compute the correct results. So that kill credit is given each time an attack is trigger and before the 0 second timer expires you need to check if the just received damage is going to be fatal and if so you abort the upcoming damage blocking, lower the units life to 0.406 and then let it die.
As you can see, this is no easy task in WC3. If your armor values are static you can try hardened skin but if they need to change...