Warcraft III resources & community, 2003–2006 · archived

Draining and restoring a % of life.

4 posts
#1

Draining and restoring a % of life.

I am having trouble finding a command that will allow me to take away % of a units life and after a set amount of time restore that life to the unit, (if it is still alive however). Hopefully someone here can help with this issue and preferably not use JASS (although if it must be done then I am fine with it so long as you help me with the rest of the ability.)
Thanks for reading
-Murlok
#2
First make a variable: Integer Type (UnitLife)

Actions:
Set 'that integer variable' = life of 'unit'
Unit - Set Life to Percentage => Arthematic => Life of triggering unit - ...%

When u restore it: Set life of 'unit' to 'the integer variable'
#3
Thanks for the help, however I see a problem with this script, being that if the unit in question nulls all damage it takes between the time it lost % of its life and gained it back, or am I reading this script wrong.
#4
yes, ur right. Maybe u could turn on a trigger and every time it gets damage, u do: set the variable = variable + how much dmg the unit gets