PDA

View Full Version : [Question] Battle Box Font?!


korjamer
May 1st, 2012, 02:47 PM
Does anyone know how to change the font of just the battle boxes in essentials? I'm planning on making them outlined Like in Black and White. (It helps make them more readable if you have a small or transparent box.) There has gotta be a line of code some where in PokeBattle_ActualScene that could be changed. I have a font that would work very nicely I just don't know how to change ONLY the name, level, and HP. A little help? I'm stuck. :(

FL
May 1st, 2012, 03:42 PM
In PokeBattle_ActualScene, before the second line 'pbDrawTextPositions(self.bitmap,textpos)' add:


self.bitmap.font.name="Power Red and Green"
self.bitmap.font.size=29
An example with FrLg font.

korjamer
May 3rd, 2012, 11:23 AM
Thank you so much! It worked! :D
I have one question though...
there is a command (<outln>...</outln>)
that causes the text in a message to have an outline rather than a shadow. How would I apply that to the battle box font?
Also, how would I change the color of the outline/text?
Thanks again!

FL
May 3rd, 2012, 03:55 PM
Thank you so much! It worked! :D
I have one question though...
there is a command (<outln>...</outln>)
that causes the text in a message to have an outline rather than a shadow. How would I apply that to the battle box font?
Also, how would I change the color of the outline/text?
Thanks again!Search for BOXTEXTBASECOLOR and BOXTEXTSHADOWCOLOR.

The outline is a little complex to explain, but the effect is done by:

bitmap.draw_text(ch[1],ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+1,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1],ch[2]+2,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+1,ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+1,ch[2]+2,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2],ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+1,ch[3]+2,ch[4],ch[0])
bitmap.draw_text(ch[1]+2,ch[2]+2,ch[3]+2,ch[4],ch[0])

Where:
ch[0]=graphic ? graphic : textchars[position],
ch[1]=x+xStart
ch[2]=texty
ch[3]=width+extraspace
ch[4]=lineheight

Take a look in DrawText script to see where each variable comes.
The ch[1] gets +1 before the actual text is draw.

korjamer
May 7th, 2012, 07:08 AM
Okay... Yeah I probably should learn ruby before I dive any deeper into this...
I'm pretty confused lol.

Should I just paste the code into the same place I put the code that allowed me to change the font...? Because that doesn't seem to work as it gives me an error.

Is there an easier way to apply the code? I really do appreciate your help.

FL
May 8th, 2012, 05:27 PM
No.
You need to see DrawText script to see where each of this five variable 'ch' comes, then use equivalent on script. This require some script knowledge.
Picks ch[2] as example, in the script it comes from texty that is the y-distance and in this script the equivalent is '@spritebaseY+6' ('@spritebaseY+40' in HP case).
Now I going to make some otimizations that beginners scripters can't follow, and all that you need to do is to change the second line 'pbDrawTextPositions(self.bitmap,textpos)' in PokeBattle_ActualScene to:

oldfontcolor=self.bitmap.font.color
for position in textpos
textsize=self.bitmap.text_size(position[0])
ch=[position[0],position[3] ? position[1]-textsize.width : position[1],
position[2],textsize.width,textsize.height]
self.bitmap.font.color=shadow
self.bitmap.draw_text(ch[1],ch[2],ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1],ch[2]+1,ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1],ch[2]+2,ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1]+1,ch[2],ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1]+1,ch[2]+2,ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1]+2,ch[2],ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1]+2,ch[2]+1,ch[3]+2,ch[4],ch[0])
self.bitmap.draw_text(ch[1]+2,ch[2]+2,ch[3]+2,ch[4],ch[0])
self.bitmap.font.color=base
self.bitmap.draw_text(ch[1]+1,ch[2],ch[3],ch[4],ch[0])
end
self.bitmap.font.color=oldfontcolor