Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hpbar on hud is not compatible visually with MAX_HEALTH stat #3807

Open
1 task done
derxgbb opened this issue Oct 16, 2024 · 7 comments · May be fixed by #3934
Open
1 task done

hpbar on hud is not compatible visually with MAX_HEALTH stat #3807

derxgbb opened this issue Oct 16, 2024 · 7 comments · May be fixed by #3934
Labels
bug Something isn't working

Comments

@derxgbb
Copy link

derxgbb commented Oct 16, 2024

Describe the bug

Hello!

I came to report a bug which I'm sure existed for years. I don't know if this bug wasn't noticed or it isn't fixable. I searched about it on github but maybe it was a report on mantis who knows.

In the singleplayer the hpbar is dinamically growing by the fact that CJ exercises his body. It grows to a maximum of 150 hp. This can also be achieved by doing the paramedic missions.

The hpbar is designed to show hp between 0 and 150.

However in MTA for some reason we have maximum hp of 200. (possibly because we can't set armor to have 150 maximum armor, but it is just my accusation)

Steps to reproduce

Launch a local server and observe the hpbar after executing some commands.

first get the current value of MAX_HEALTH it will be useful when resetting:

getPedStat(getPlayerFromName("derxgbb"),24)

derxgbb executed command: getPedStat(getPlayerFromName("derxgbb"),24)
Command results: 569 [number]

Now set it to 1000 so the hpbar will get its maximum width.

setPedStat(getPlayerFromName("derxgbb"), 24, 1000)

derxgbb executed command: setPedStat(getPlayerFromName("derxgbb"), 24, 1000)
Command results: true [boolean]

By default we have 100hp with a maximum of 200 now. The hp on the bar is 'kinda' in the middle as it should.
Now set the hp to 150

setElementHealth(getPlayerFromName("derxgbb"),150)

derxgbb executed command: setElementHealth(getPlayerFromName("derxgbb"),150)
Command results: true [boolean]

It will look like its almost full, but there is still 50hp left.
Now set it to 173.

setElementHealth(getPlayerFromName("derxgbb"),173)

derxgbb executed command: setElementHealth(getPlayerFromName("derxgbb"),173)
Command results: true [boolean]

With 173hp it maximises and the 27hp which is left till 200 is not shown. Image

Version

It happens on all versions for years.
Currently:
Server & Client: 22771

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@derxgbb derxgbb added the bug Something isn't working label Oct 16, 2024
@derxgbb derxgbb changed the title hpbar on hud is not compatible with MAX_HEALTH stat hpbar on hud is not compatible visually with MAX_HEALTH stat Oct 16, 2024
@derxgbb
Copy link
Author

derxgbb commented Oct 16, 2024

I also mentioned it here: #3791 (comment)

@FileEX
Copy link
Contributor

FileEX commented Oct 20, 2024

I don't understand where the value of 200 HP comes from. In the GTA
code, the maximum HP value is 176, not 200. That's why 100 HP is more than 50%, and 173 fills (almost) the entire bar

Image
Image

@derxgbb
Copy link
Author

derxgbb commented Oct 21, 2024

https://i.imgur.com/HLln4VA.png

https://i.imgur.com/h0HD2YL.png

@FileEX
as you can see I can set my current hp to 200, (of course if I set the maximum to 200 as well before that)

On the second pic I tested what happens when I slap myself (-10HP) and as you can see I have 190HP with a full hp bar.

The hpbar maximises at 173 hp visually for me on 1920x1080 (idk if screensize matters)

btw I don't even understand the 176 as well as 200 hp where these comes from since in the singleplayer the maximum hp was 150 and you could get them the way I mentioned in the first post. I can only think of having 200hp because of the armor here in MTA can not be set to 150

@FileEX
Copy link
Contributor

FileEX commented Oct 21, 2024

Probably it's a bug in MTA that allows setting 200 HP, while the maximum can only be 176.

On the second pic I tested what happens when I slap myself (-10HP) and as you can see I have 190HP with a full hp bar.

190 HP shows a full health bar because the width of the bar (progress) is calculated relative to the maximum value of 176, not 200. So, anything above 176 will always be displayed as 100%.

btw I don't even understand the 176 as well as 200 hp where these comes from since in the singleplayer the maximum hp was 150 and you could get them the way I mentioned in the first post

MAX_HEALTH after setting

setPedStat(getPlayerFromName('derxgbb'), 24, 1000) 

is 176, not 150 — even in single player

@derxgbb
Copy link
Author

derxgbb commented Oct 22, 2024

So I had some time today and tested these things in singleplayer by using a mod which displays hp and armor in numbers.

It seems that after completing the paramedic side mission & saving the game the maxhp will be 176.
https://i.imgur.com/EECTZJJ.png

I was curious about the armor. I only knew that 150 armor should work on all PC versions except an older version of the steam ports.
After completing vigilante I get 150 armor.
https://i.imgur.com/NykHDoj.png (the number is overlapped by other text but you can see)
(it also works without silentpatch)

If we analyze the other 3D era GTA games then we can see normal rounded numbers as max hp and armor so IDK why Rockstar went with 176 in GTA:SA
GTA3: 100 maxhp, A hooker can blowjob you up to 125.
GTA:VC: 200 maxhp at 100% game completion, 225 by a hooker.
GTA:VCS and GTA:LCS: 150 maxhp, hookers are in play in these games too but I'm not sure if you get to 175, or you stay on 150.

In GTA:SA seems like Rockstar messed up some things. The maximum hp should be 150, earning it by paramedic or by exercising.
I read an article about hookers in GTA:SA, they give you +26. I don't know why not +25 tho....
Seems like Rockstar just added these numbers and that is how 176 is the maxhp.

Normally a hooker should increase your hp above the maximum and we should see that in action, for some reason this doesn't work.

I checked GTA:SA DE as well.
https://i.imgur.com/NxPup0G.png
This is a 100% savefile so paramedic & vigilante have been done. The width of the bars are the same. On the stats menu I can see that the armor is 150. So Its good to think that the maxhp is 150 as well. Hookers don't increase it tho, so the same width is visible even after a finished good time.
If you start a new game and pick up the armor next to Ganton you can see how they fixed this. Simply the base hp is now 74(-26)
https://i.imgur.com/9qf4Qub.png
I'm only guessing the 74, because If I set my hp to 150 on a local server on MTA, the remaining bar of maxhp is the same width as the difference in DE version between 100 armor(bar) and the hp bar.

So by a conclusion, I don't know how this problem should be fixed.
I do think that Rockstar wanted to make the hpbar to be maxed on 150. I think Rockstar didn't know how should they show the +26 hp from hookers. In GTA:VCS and GTA:LCS the hpbars doesn't grow but a + sign is added to it, I guess that's how Rockstar should have been shown the +26 hp in GTA:SA as well...

I don't know if MTA should go with 150 max hp from now, with the hpbar optimised to 150.
Others could say that we can stay with 200 max hp just make the hpbar optimised for it.
Or we can go with 176 maxhp, I really don't know what should be done here.

There is another bug, reported in #3791 which says that you can set your armor on clientside to one million if you'd want to.
If there is a way to make setPedArmor to give 150 armor both on client & server side then MTA should go with 150 or to 176 maxhp.

@FileEX
Copy link
Contributor

FileEX commented Oct 22, 2024

Generally speaking, the correct value is 176, and that's how it should be everywhere, but I'm afraid that at this point it would require changes in many parts of the code, which could potentially conflict with backward compatibility. So, I think the least intrusive solution would be to adjust the HP bar to handle a maximum of 200 HP instead of 176

@derxgbb
Copy link
Author

derxgbb commented Oct 22, 2024

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants