Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: JohnGarett on December 22, 2016, 04:27:41 am

Title: [RESOLVED] How to make dynamic font change in a script call
Post by: JohnGarett on December 22, 2016, 04:27:41 am
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.
(http://i.imgur.com/vE8Pgf1.png)
(http://i.imgur.com/rNVapIt.png)
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!
Title: Re: How to make dynamic font change in a script call
Post by: KK20 on December 22, 2016, 02:25:56 pm
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.
Title: Re: How to make dynamic font change in a script call
Post by: JohnGarett on December 22, 2016, 03:06:02 pm
Thank you so much, it resolved my issue!