- Joined
- Oct 9, 2015
- Messages
- 721
When the current life of an unit becomes 1 or less I want to keep setting it to 1 whenever it takes damage, I have bribe's damage engine but could't figure out how to do it. All help is welcome!
Units die when below 0.405 life.
There was some conversation about this a while ago and the results were inconclusive as someone kept changing the threshold. In any case the cutoff constant seemed to be exactly 0.405 although some people denied it and others argued over if it was "less than" or "less than or equal to".When life is set to 0.405 with a trigger/code, the unit dies. So units dies when their life equals or goes below 0.405.
Nope, there is no proper way to visually show anything lower then 1 besides the number going red since they didn't add a way to show negatives on the health bars. The interface can also only show integers so if you bypass 2.14 billion I think it is then you'll only see a black bar since it can't show something that is higher then what was coded.Is it possible to set to zero too ?
There was some conversation about this a while ago and the results were inconclusive as someone kept changing the threshold. In any case the cutoff constant seemed to be exactly 0.405 although some people denied it and others argued over if it was "less than" or "less than or equal to".
It is worth noting that setting unit current life with triggers applies a HP delta rather than absolutely setting the health. The HP delta is subject to floating point error as it uses a 32bit float. For example if you were to set a unit with a billion HP to 1 life it will die because the floating point error of the delta results in it being set to 0 life.
There was some conversation about this a while ago and the results were inconclusive as someone kept changing the threshold. In any case the cutoff constant seemed to be exactly 0.405 although some people denied it and others argued over if it was "less than" or "less than or equal to".
It is worth noting that setting unit current life with triggers applies a HP delta rather than absolutely setting the health. The HP delta is subject to floating point error as it uses a 32bit float. For example if you were to set a unit with a billion HP to 1 life it will die because the floating point error of the delta results in it being set to 0 life.
I think if the unit falls below 0.405 life at any time it instantly dies so setting it twice would still kill the unit. The first set would kill the unit, the second set would raise the life of the corpse.To avoid floating point error you can set it twice, it usually fixes itself.
I think if the unit falls below 0.405 life at any time it instantly dies so setting it twice would still kill the unit. The first set would kill the unit, the second set would raise the life of the corpse.
Also if the life is something insane you will need to set it more than twice anyway.
0.406 (which should not kill the unit) should read 0 health on the UI because it likely rounds to nearest. I know it does this in StarCraft II but there the mathematics have no floating point error.
He probably meant to set the life to 10,000 first and then to 0.41 avoiding the floating point error for units up to 99,999,999,999 hp
Sadly 0.406 still shows 1 in red on the UI, wc3 rounding = bad.
Coming from a mummy...That which has no life, should be dead.
SC2 does it, its quite funny at times. Even seen it reported in Heroes of the Storm.Showing 0 would be against logic in my opinion. That which has no life, should be dead.