Jump to content
  • 0

HP bar display


Variant

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  52
  • Reputation:   6
  • Joined:  01/06/12
  • Last Seen:  

So I've been messing around to see how far I could push the parameters of a character (such as max HP, SP, damage, etc...) and I came across a problem. When I raised my HP above 21,000,000, the HP on the HP/SP bar that the player sees (right underneath the character) showed an empty bar. My actual HP value was over 21,000,000 however. What's weird is, once HP drops below 21,000,000 from damage or something, it'll show up correctly (e.g. having 19,000,000/22,000,000, will show correctly, but if you heal past 21,000,000 it'll show as empty).

Now I realize this is a limitation of the client, but while I was looking for a way to remedy this I happened to stumble upon this neat little piece of code, written by skotlex:

if( maxhp > INT16_MAX )
{// To correctly display the %hp bar. [skotlex]
 WFIFOW(fd,6) = hp/(maxhp/100);
 WFIFOW(fd,8) = 100;
}

And so I went and implemented that trick (showing the hp out of 100) in the party HP bar function in clif.c and it worked like a charm, I could see the HP bar of a party member going down accurately enough. Then I went to go look for a way to show it to the player in question, but I think clif.c just sends the HP values to the player and then the client just does something with that, as opposed to how party HP bar-showing works, where it's possible to send it as a percentage (out of 100).

As a quickfix, I just made a command called @showhp that'll show your actual HP as being a % out of a 100, but this doesn't help that much... Normally I'd try to shove ShowDebug's everywhere in order to find where the problem is, but in this case, I don't really understand how the HP meter works.

Does anyone have any ideas on what I could do to have HP above 21,000,000 show correctly? Is there a way to have the HP bar show as a % out of 100, but not actually show the HP (in the character information window) as being 100?

Edit:

Forgot to mention, I'm using the 06-14-11b client, and am on rA rev. 154XX

The @showhp command I added is simply implementing the % trick in clif_updatestatus, by making max_hp show up as 100, and hp show up as a fraction (hp/max_hp * 100). This makes the HP on the character display also show up as 100 however...

Edited by Variant
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...