• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Why do these units have different hp?

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
Hi,

I'm playing a map where units can have their health upgraded many times.

Most of the upgrades are arithmetic bonuses (i.e. adding a flat amount, e.g. +50 HP), however a few do it based on percent, e.g. Increases all units max health by 8% of their current maximum health.

I haven't noticed this before, but it appears sometimes a unit actually gets the wrong amount of max health. In particular, this water elemental should have 720 HP, but some of them get a max of 721! Is this a floating number precision error? If so, why would it apply non-deterministically?

s2z1gp.png
11t1vyv.png


The base health of the elemental was 550 HP. I got a total of +120 flat health bonuses = 670, and then a percent bonus of 9% I believe.
 
Level 3
Joined
Jul 16, 2014
Messages
63
That is indeed very weird. It might be because of a calculation error, if the assigned hp is xxx,5. If it gains 9% bonus hp, it still doesnt make sense though, given that 550*1,09+120=719.5

Don't know what to tell you man, never seen that before :)
 
Yeah this can happen, it happens often when dealing with handicaps or % based upgrades. You can fix this by recreating the unit however its just a little visual error, not entirely certain though.

If you give me the map that has this flaw I can research into it and check if it causes more then that visual problem. It was lame of blizzard to use a real for health and to visually show it by a integer. You can check it yourself to see if it is still correct and just visually failed by displaying real(health of unit). Let me know results if you do check it.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The units may have gone through different stages of the upgrade and therefore face calculation differences. For example, the first one was already there, got upgrade A with a little imprecision, then got upgrade B which did not revert the previous upgrade but added to the already a little off hp result. The other unit was created after the upgrades have been done, so the upgrades were merged in numbers and applied to the unit together. Just a possibility.
 
Status
Not open for further replies.
Top