The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: heisenman on November 24, 2010, 06:15:50 PM

Title: Scene_Menu Customization
Post by: heisenman on November 24, 2010, 06:15:50 PM
Editing scripts to suit my needs I've learned some simple yet useful things, and this is the result of what I've learned so far, a simple configurable Scene_Menu modification.



Description

The scope of this script is to edit simple values in the Scene_Menu, such as windows coordinates and opacity. It also provides the option to have a picture as background.


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg84.imageshack.us%2Fimg84%2F2686%2F48352948.png&hash=7f08cd4702bf8cdab2ac071e3a267d892b7e7ea4)


Instructions

Paste this script ? Materials but above ? Main in your Script Editor.


Compatibility

Does not work with other Menu Scripts.


Script


Code: [Select]
#==============================================================================
# Scene_Menu Customization
#------------------------------------------------------------------------------
# The scope of this script is to edit simple values in the Scene_Menu, such as
# windows coordinates and opacity. It also provides the option to have a picture
# as background.
#
#==============================================================================
# Instructions
#------------------------------------------------------------------------------
# Paste this script ? Materials but above ? Main in your Script Editor.
#
#==============================================================================
# Compatibility
#------------------------------------------------------------------------------
# Does not work with other Menu Scripts.
#
#==============================================================================



#==============================================================================
# Configuration start here.
#==============================================================================

module SM_S
 
  # Background picture, place inside "Graphics\System" folder.
  # Omit file extension (.jpg/.png), leave "" for no picture. Case sensitive.
  MenuBack = "Gameover"
 
  # Opacity of the background picture. Insert a value  between 0 and 255.
  # 0 = invisible, 255 = full opacity. 255 is default value.
  MenuBackOpacity = 255
 
  # X coordinate of the command window. 0 is default value.
  CommandsX = 0
 
  # Y coordinate of the command window. 0 is default value.
  CommandsY = 0
 
  # Opacity of the command window. Insert a value  between 0 and 255.
  # 0 = invisible, 255 = full opacity. 255 is default value.
  CommandsOpacity = 255
 
  # X coordinate of the status window.
  # 160 is default value.
  StatusX = 160
 
  # Opacity of the status window. Insert a value  between 0 and 255.
  # 0 = invisible, 255 = full opacity. 255 is default value.
  StatusOpacity = 255
 
  # X coordinate of the gold window. 0 is default value.
  GoldX = 0
 
  # Y coordinate of the gold window. 360 is default value.
  GoldY = 360
 
  # Opacity of the gold window. Insert a value  between 0 and 255.
  # 0 = invisible, 255 = full opacity. 255 is default value.
  GoldOpacity = 255
 
end

#==============================================================================
# Configuration ends here.
#==============================================================================



#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @command_window.x = SM_S::CommandsX
    @command_window.y = SM_S::CommandsY
    @command_window.opacity = SM_S::CommandsOpacity
    @gold_window = Window_Gold.new(SM_S::GoldX, SM_S::GoldY)
    @gold_window.opacity = SM_S::GoldOpacity
    @status_window = Window_MenuStatus.new(SM_S::StatusX, 0)
    @status_window.opacity = SM_S::StatusOpacity
  end
  #--------------------------------------------------------------------------
  # * Create Menu Background
  #--------------------------------------------------------------------------
  def create_menu_background
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = Cache.system(SM_S::MenuBack)
    @menuback_sprite.opacity = SM_S::MenuBackOpacity
    update_menu_background
  end
end
Title: Re: Scene_Menu Customization
Post by: modern algebra on November 24, 2010, 07:33:18 PM
Thanks for sharing. Remember though that there is no need to include methods that you do not modify, so long as you are not directly replacing the default script. Either way, simple edits like this are a good way to start learning how to script. I hope you keep at it.
Title: Re: Scene_Menu Customization
Post by: heisenman on November 24, 2010, 08:54:34 PM
Quote
there is no need to include methods that you do not modify
I did not know, thanks for telling me.
I'll be more careful next time.

EDIT: well, since it was a rather easy job, I updated the script.
Title: Re: Scene_Menu Customization
Post by: heisenman on November 25, 2010, 12:14:45 PM
Changed @menuback to @menuback_sprite.
*hangs head in shame*