HP Bar Script Edit (Centering Large HP)

Hey all, 


So I am using this visible enemy bar and visible HP by V.M. of D.T.  I use Yanfly core and Yanfly Ace and obviously use VX Ace.


I was wondering if anyone would like to take a crack at throwing a line or two in there that CENTERS the numbers.  With this script, as the HP on enemies grows, the numbers above the HP bar begin to look "off to the right" because essentially they are starting in the same spot, but due to a 4 digit HP, it's no longer centered.  Thanks in advance!


The script can be found here... http://pastebin.com/Qj9gAKq9


Luke
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Please post a LINK to the script you are using.  We don't like people putting other people's scripts into their posts on this forum.
bump
bump
You can try to edit this line in the script:


@text_display.bitmap.draw_text(0,0,100,@text_display.height,text)


To look like this:


@text_display.bitmap.draw_text(0,0,100,@text_display.height,text,1)


So, just add that extra ",1" at the end before the bracket.


That should center the text, but the bitmap used for text display can still be off relative to the bar's image, and would still make your text look not centered. 


I see some offset settings in the script, so if you see that the text is not centered after the edit, try to move around the bars/text positions/offsets, see if that helps or not.
You can try to edit this line in the script:



@text_display.bitmap.draw_text(0,0,100,@text_display.height,text)


To look like this:



@text_display.bitmap.draw_text(0,0,100,@text_display.height,text,1)


So, just add that extra ",1" at the end before the bracket.


That should center the text, but the bitmap used for text display can still be off relative to the bar's image, and would still make your text look not centered. 


I see some offset settings in the script, so if you see that the text is not centered after the edit, try to move around the bars/text positions/offsets, see if that helps or not.



Sixth's answer is indeed correct.  Thank you, Sixth.  This adjusted line now centers the HP numbers, except they are now centered at the end of the HP bar.  To center the numbers in the middle of the HP bar, I had to adjust the X offset found in line 67 to this:


TEXT_OFFSET_X = -12


Again thanks for all your help!



Luke

Original thread: https://forums.rpgmakerweb.com/threads/hp-bar-script-edit-centering-large-hp.56652/