Help - Search - Members - Calendar
Full Version: +++Menu backgrounds and custom fonts+++
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
KPaxian
Changing menu backgrounds and fonts



Attention!!! Beginners only!


OK. I'm not exactly sure where to post this because it's a script tutorial (in scripts or tutorials). Perhaps scripters like wora and originalwij might say this is stupid but I'm sure there are a lots of newbs who need something like this. It was my first scripting experience. I didn't even had Internet when I've done it. This is the simplest way to make backgrounds to menus and change fonts. Let's start!


ADDING BACKGROUND


First of all open your script editor and go to Scene_Menu (I've started from there). Find the "Start processing" line and just after the end insert this:

CODE
  
#--------------------------------------------------------------------------
  # * Create Title Graphic
  #--------------------------------------------------------------------------
  def create_title_graphic
    @sprite = Sprite.new
    @sprite.bitmap = Cache.system("THE NAME OF THE FILE")
  end
  #--------------------------------------------------------------------------
  # * Dispose of Title Graphic
  #--------------------------------------------------------------------------
  def dispose_title_graphic
    @sprite.bitmap.dispose
    @sprite.dispose
  end


Change THE NAME OF THE FILE with the name of the file you want to use as background. It has to be in the graphics\system folder. I recommend it to be with the same size as the window (NOT FULL SCREEN!!!). I think the resolution was 544x416. Edit and add all you want.
Next you need to see the background so you have to hide the windows. Here's the way to do it:
1. Find the following: @command_window.something
NB: Don't add anything if there's something in front of the window name, because you'll get an error!!! Find some other line in different section.
2. Exactly under the same line type: @command_window.opacity = 0 (this will make the window transparent)
3. Do this with every window in that script. (they are status and gold if you work in Scene_Menu)
4. Repeat this procedure (incuding the one with the title graphic) with every scene script.

Here's a list with the windows that should be changed in every scene. The digits show the line under you should write. Note that when you add something on other line it changes the line order in that script:
  • Scene_Title:
    @command_window - 154
  • Scene_Menu:
    @gold_window - 22
    @status_window - 23
    @command_window - 78
  • Scene_Item:
    @help_window - 16
    @item_window - 21
  • Scene_Skill:
    @help_window - 23
    @status_window - 26
    @skill_window - 30
  • Scene_Equip:
    @help_window - 28
    @equip_window - 33
    @status_window - 35
  • Scene_Status:
    @status_window - 22
  • Scene_File:
    @help_window - 25
    savefile_window (Enter Window_SaveFile and under the def refresh in the refresh section add self.opacity = 0. Same should be done to change fonts in that scene (see the font changing section for details))
  • Scene_End:
    @command_window - 89
  • Scene_Shop:
    @help_window - 15
    @gold_window - 17
    @dummy_window - 19
    @buy_window - 21
    @sell_window - 26
    @number_window - 31
    @status_window - 35
    @command_window - 86



CHANGING FONTS


Enter the window script. Window_Message for example (if you change it this will be the message displaying font in your game)
1. Find something like: self.something (Don't change if there is something written in front of self!!! Find some other line in different section)
2. On the next line type: self.contents.font.name = "NAME OF THE FONT" (You must have it in your Game\Fonts folder to work)
3. For the adjustments use:
self.contents.font.size = 24 (example)
self.contents.font.bold = true/false (Bold or not)
self.contents.font.italic = true/false (Italic or not)
self.contents.font.shadow = true/false (Shadowed or not)
lahandi

Hey, thanks for the short tutorial mate. Its really usefull for people who doesnt have knowledge on script like me.
I found error but i manage to fix it. If you add

QUOTE
@command_window.opacity = 0


Below the

QUOTE
case @command_window.index


It will get Syntax error. If you remove it, then its all okay.

My goal is to get rid the window menu on title sceen. And it works nicely.

More easy-script-tutorial like this, please.

Thanks. smile.gif

KPaxian
QUOTE (lahandi @ Nov 20 2008, 01:44 AM) *
Hey, thanks for the short tutorial mate. Its really usefull for people who doesnt have knowledge on script like me.
I found error but i manage to fix it. If you add

QUOTE
@command_window.opacity = 0


Below the

QUOTE
case @command_window.index


It will get Syntax error. If you remove it, then its all okay.

My goal is to get rid the window menu on title sceen. And it works nicely.

More easy-script-tutorial like this, please.

Thanks. smile.gif


Exactly that's what I've meant! If there's a problem tell me!
I think I've wrote somewhere that if you have anything before self.something you shoul not add anything. I've forgot to mention that it's the same with the @command_window.anything. Find different line in different section. Line 156 is where I've added it and there's no problem. I'll add a list with the lines soon. Thanks for posting that! thumbsup.gif thumbsup.gif thumbsup.gif
KPaxian
The script was modified!!! Added shop background section and list with the lines for the scene scripts.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.