[General] Research based on Rhan leads to negative maximum HP

Level 28
Joined
Feb 2, 2006
Messages
1,629
Hi,
I have a very strange bug in my map.
There is this research based on Rhan which increases maximum HP of units ("Hit Point Bonus").
It has 75 levels and starts with 20 and increase by 20 every level.
It affects almost any trainable unit.
When it reaches level 13 or something (different for different units), units die instantly when they are trained.
I printed some stats of the units to get more information and it showed that they have negative maximum HP:
A worker has base hit points maximum 250.
Level 13 kills it which would be a bonus of 13 * 20 = 260 but a bonus of 12 * 20 = 240 does not.
Does it have to go above 500 HP?!
It does not die when it has 490 HP.
And yes it has -10 HP then when it should have 510 which looks like some kind of overflow.
Is there a limit of 1 byte or something for the HP bonus field rhpx?!

I could not reproduce this issue in another map so I guess some other code might have an effect but I don't know which.
The upgrade also increases the attack damage by 1 and the mana percentage by 0.015 but only setting the HP to 0 fixed the issue and of course removed the bonus.
I hooked SetUnitState and could not find any call for max HP.
The map also contains BonusSystem etc. which is not applied to the unit.

Is it maybe some other global ability on the map, some kind of aura?!
I am checking buffs/spell effects now since I have no idea anymore.

Any ideas?
 
Last edited:
Top