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.

On-the-fly Font Changing. [Resolved]

Hello. I'm looking for a script that will allow me to change fonts in the middle of a message.  I'd prefer for it to use backslash commands, but as long as it works, I'll be happy.
What I'm wanting exactly is to be able to use a rune-like font (which I have created myself) to show when someone is speaking in a foreign language, then be able to revert back to the default in the same text box.

It should look something like this.
http://i127.photobucket.com/albums/p142 ... Sample.png[/img]

Also, if it wouldn't be too difficult to script, I'd like for it to be able to read the ttf from the game directory.  This is just about convenience though, so others won't have to take the time to download and install the extra font if they want to play my game. So don't feel obligated to do this part if you'd rather not.

Thanks a lot.
 

khmp

Sponsor

This was recently asked in RGSS support so here's the same answer I came up with there.

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

Then before the message you want to change the font. Have the "Script..." event command with the code below.
Code:
$scene.message_font = 
'font name here'
It doesn't mix and match fonts within the same window. Nor does it rely on some backslash to be placed with the window message. Simply a state machine type of call. You will need one after the message window call to change it back to the default if you wish as well.

Good luck with it Vinderex! :thumb:
 
Thanks.
The only problem there is that I can't identify the speaker the way I usually do, since then their name would also appear in runes, and it looks really weird.  That's the main reason why I wanted something similar to backslash commands.
If I can get an alternate way to identify the speaker, this would be perfect.  Otherwise I still need a way to use more than one font in the same text box.

I remember seeing a script quite a while ago that allows pictures to be placed inside text boxes, but now I can't find it. :dead:
 
Hooray! I found something!
Figures that I find a font changing script in the same package as a picture display script.  :tongue:
Cool! I think I just might use both anyways even though I really only need the font changing now.  I like the pics! :D
Well, time to go through every message I ever made and add some pictures to it.  That and actually make the pictures.  :lol:

Thanks for the help.
 

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