Open ArranTuna opened 5 years ago
Adding to what I've previously said in the Mantis issue, I double-checked the fact I've stated with two different savegames in which I've maxed health by using GTA: SA Savegame Editor v3.2. It turned out my memory back then was correct:
I have also checked that the maximum health which is obtainable in singleplayer is 176 by using a ingame CLEO mod which shows the HP number on the HUD, in an attempt to minimize the threats to the validity of my conclusion, and the results that I highlighted in the image confirmed that my suspicion is correct:
Therefore, as MTA maximum health calculation seems to be inconsistent with GTA's, we would need to either modify GTA HUD health bar drawing behaviour to match MTA's (which could be more complex to do, but improve backward compatibility) or MTA maximum health calculation behaviour to match GTA's (this would be more simple to do, but it could introduce differences in gameplay due to scripters no longer being able to set a ped health to 200 as expected right now).
According to @ccw:
Health is synced in 8 bits and I think that
*1.25
/1.25
is (incorrectly) matching the sync quantization. Correct math is inSPlayerHealthSync::Write
andSPlayerHealthSync::Read
Might have to do with this sync and tbh should be fixed while at it.
Describe the bug Ped's health is not fully in sync with the health bar. See attached example picture. Note that this doesn't occur in SP.
To reproduce 1) Spawn with default healthstat (569, 100hp) and lose/set Hp until 96. The loss of 4hp, will not be synced to the healthbar, fractional loss will appear only from -5hp. 96hp ped health means its visible as full health bar.
2) Second example, set hpstat 1000 and 200 hp. The bar will start losing as soon as you reach under 176 hp, not earlier.
Second could be either the 569 =100hp 1000 (ca. 0.96x) math and relies on that, but then why can you set ped's health to 200hp, while infact 180hp is 100% possible health?
The last example also suffers from the minus -4hp desync. 180 hp could be full health for 1000stat, but the health bar also starts shrinking from 176 only here. (180 = 100% - 4hp syncfault)
Expected behaviour
Screenshots
Version Unstated at mantis.
Additional context
From https://bugs.mtasa.com/view.php?id=8105