Allright, thanks for explaining that.
This is just an idea, I don't know if it will work, or if it is what you need.
If it is for the DOT-trigger (it's an ability, so it's easier to add I think...):
In the trigger where the ability activates, set a real variable to the damage that needs to be dealt over time.
You probably have a DOT-trigger, the trigger that deals the actual damage, you need to add 1 if/then/else construction in it: if the variable is greater than or equal to the HP of the targetted unit, then set the life to 1 and skip the remaining actions.
If you really want that the unit can take no damage from any source if it would kill him:
Create an initially off trigger with the actions
"if (Damage Taken) is greater than or equal to (Life of unit), set life of unit = (life of unit + (Damage Taken))".
Then, at map init (or when you choose the hero, or when the unit is bought, I don't know what it's for...), create an action that's something like
"create event for
-
- Unit takes damage"[/I].
-
Whenever you want that unit to be "invincible" (just so he doesn't die, he can still take damage), activate the trigger (be it through an ability event, when entering a region or whatever).
-
If it's for MUI, you can give the unit an array and create a boolean (array) that says when the unit needs to be invincible.
-
If the boolean is true, he will gain his HP back, otherwise he will die.
-
This is actually not a really good trigger, there are probably better ones, since this checks 1 step ahead:
-
If the unit with 60HP left is attacked for 30 damage, he will gain the 30HP back (because after the attack he has only 29HP left, which is equal to the damage dealt).