[RESOLVED] How to make dynamic font change in a script call

Started by JohnGarett, December 22, 2016, 04:27:41 am

Previous topic - Next topic

JohnGarett

Introduction
Greetings everyone I am working with RPGMakerXP for a long time and I was trying to find my own way to change a font with a simple script call in RGSS1 however it simply does not work in the way i intended. The thing is that the font is not changed no matter how many times I would show message box from any event.


Not until I would make the player see for example "Save screen", "Game Over", "Main Menu" etc.
Only after that the font is changed. However to have separate characters speaking in different fonts in one event I cannot simply show save screen every time I want font to change.
What I'm looking for
So if there is any workaround to force change the font during event with a script call, common event or variable I would be grateful!

KK20

Just fix it please: ShowHide

Place above Main, but below anything that modifies Window_Message:
class Window_Message < Window_Selectable
  alias refresh_font_name refresh
  def refresh
    self.contents.font.name = $fontname
    refresh_font_name
  end
end

Use script call before a message box:
$fontname = "Arial"


What was wrong: ShowHide

Window_Message is only created once in Scene_Map. Like all other windows, it creates a contents property, which is a new Bitmap object. Newly initialized bitmaps simply clone the values of the class Font. In order to change these font values, you have to access and modify the window's contents.font property. Changing Font.default_name won't be recognized by already created bitmaps.

You clearly must be using some custom script because those global variables do not exist in RMXP.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

JohnGarett