I'm scripting a custom spell that reduces damage taken by a certain percentage. I've made a trigger to add the unit to the event when it takes damage. My question is, "To reduce damage by 20%, would the following functions work properly?":
Will this refund the correct amount of damage? Also, will this prevent the character from dying if they have hit points left after this triggered reduction? For example: I have 19 hp left, and my opponent deals 20 damage to me, but after this triggered reduction I should still have 3 hp left.
Trigger:
- Actions
- Set TempReal = ((Damage taken) x 0.20)
- Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + TempReal)
Will this refund the correct amount of damage? Also, will this prevent the character from dying if they have hit points left after this triggered reduction? For example: I have 19 hp left, and my opponent deals 20 damage to me, but after this triggered reduction I should still have 3 hp left.