Menu Command Backgrounds

Introduction

This is a simple script that allows you to place command backgrounds behind the commands

in the menu.

Screenshot

Spoiler
Capture.PNG
Script

Spoiler
#==============================================================================## Command Backs by Z3R0X505 ##------------------------------------------------------------------------------## Places a background behind each of the menu commands. ##==============================================================================## Terms of Use: ## Free to use in commercial and non-commercial projects as long as credited. ##==============================================================================#module Menu_Backs # Name of the picture placed inside the Graphics/System/ folder. # This picture has to be 160 wide and 24 in height. Command_Back = "Command_Back"end#======================== Don't edit past here! ===============================#class Scene_Menu < Scene_MenuBase alias start_backs start def start start_backs create_backs end def create_backs @menu_back = Sprite.new(@viewport) width = 160 height = @command_window.height - 24 @menu_back.bitmap = Bitmap.new(width, height) bitmap = Cache.system(Menu_Backs::Command_Back) @viewport.z = @command_window.z - 1 rect = Rect.new(0, 0, 160, 24) y = 0 loop do break if y >= height @menu_back.bitmap.blt(0, y, bitmap, rect) y += 24 end @menu_back.y = @command_window.y+12 endendclass Window_MenuCommand < Window_Command alias init_opacity initialize def initialize init_opacity self.opacity = 0 end def visible_line_number item_max + 1 end def standard_padding return 0 end def item_rect(index) rect = Rect.new rect.width = 160 rect.height = 24 rect.x = index % col_max * (item_width + spacing) rect.y = index / col_max * item_height + 12 rect endend
Credits

  • Shanghai Simple Scripts for the menu command backgrounds and the general final fantasy 13 idea.
  • Z3R0X505

Note: Modifies standard_padding & item_rect methods for window_menucommand other than that it should

         be fine in terms of compatibility with other scripts.
I was looking for one that allowed me to put graphics behind the commands in battle.
I believe you can simply adjust this to make it work for battle commands instead...


else, you can always just overwrite the draw_item method for the command window that you want and add a line for putting an image to the bitmap (probably via the blt or blt_stretch method of bitmaps)
@adiktuzmiko:

I would be very interested in doing this, so could you please explain in more detail how to do it?
Fixed script format, credit Z3R0X505.

"Command_Back" image sample which is placed in Graphics/System/ folder.
Command_Back.png

This picture has to be 160 wide and 24 in height

Preview
prev.png


Code:
#==============================================================================#
#                       Command Backs by Z3R0X505                              #
#------------------------------------------------------------------------------#
# Places a background behind each of the menu commands.                        #
#==============================================================================#
# Terms of Use:                                                                #
# Free to use in commercial and non-commercial projects as long as credited.   #
#==============================================================================#
module Menu_Backs
  # Name of the picture placed inside the Graphics/System/ folder.
  # This picture has to be 160 wide and 24 in height.
  Command_Back = "Command_Back"
end
#======================== Don't edit past here! ===============================#

class Scene_Menu < Scene_MenuBase
  alias start_backs start
  def start
    start_backs
    create_backs
  end
  def create_backs
    @menu_back = Sprite.new(@viewport)
    width = 160
    height = @command_window.height - 24
    @menu_back.bitmap = Bitmap.new(width, height)
    bitmap = Cache.system(Menu_Backs::Command_Back)
    @viewport.z = @command_window.z - 1
    rect = Rect.new(0, 0, 160, 24)
    y = 0
    loop do
      break if y >= height
      @menu_back.bitmap.blt(0, y, bitmap, rect)
      y += 24
    end
    @menu_back.y = @command_window.y+12
  end
end

class Window_MenuCommand < Window_Command
  alias init_opacity initialize
  def initialize
    init_opacity
    self.opacity = 0
  end
  def visible_line_number
    item_max + 1
  end
  def standard_padding
    return 0
  end
  def item_rect(index)
    rect = Rect.new
    rect.width = 160
    rect.height = 24
    rect.x = index % col_max * (item_width + spacing)
    rect.y = index / col_max * item_height + 12
    rect
  end
end

Original thread: https://forums.rpgmakerweb.com/threads/menu-command-backgrounds.11584/