HP Bar Script Edit (Centering Large HP)

Golden Unicorn Gaming

Savior of Astoria
Veteran
Joined
Sep 10, 2013
Messages
257
Reaction score
622
First Language
English
Primarily Uses
N/A
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
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Golden Unicorn Gaming

Savior of Astoria
Veteran
Joined
Sep 10, 2013
Messages
257
Reaction score
622
First Language
English
Primarily Uses
N/A
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top