Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Font Question

Alright, if there is already a topic for this please feel free to smack me around, because I looked for maybe an hour for something like this to no avail.

Anyways, if I was, say, making a game where I wanted to change the font for each person, world, whatever...I'd like to know how to change the font in a text box depending on a trigger, script, or what-have-you. Something so that any text after that command will be that font, until I tell it otherwise. One default font, just doesn't cut it for me.

Any help is appreciated of course, and thanks in advance.
 

khmp

Sponsor

Have you tried changing the name of the font in the quotations. Some fonts refuse to show up in XP and I don't think anyone has discovered the exact reason why.
 

khmp

Sponsor

Add this little tid bit of code above main. We will do this the hard way :wink:

Code:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :message_window
end

Then in call script:
Code:
$scene.message_window.contents.font.name = "font name"
 

khmp

Sponsor

I didn't even take that into account:

Code:
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
#  This class performs map screen processing.
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  def message_font=(font)
    return if font.nil? || !font.is_a?(String)
    @message_window.contents.font.name = font
  end
end

Code:
$scene.message_font = 
'font name here'
You can break that up into two lines like that as long as the equals sign is on the first line.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top