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.

L's Simple Custom Menu #2 VX ver.

L's Simple Custom Menu #2 VX ver.
Version: Initial
By: Landarma

Introduction

VX version of my Simple CMS #2('Retro') for XP.

Features

  • 'System' Submenu
  • Several pre-defined custom commands (Dummy, so you have to assign other custom scripts for them)
  • I can't think of more...

Screenshots


Demo

Download demo - 4Shared

Script

Code:
 

#============================================================================

# * L's Custom Menu #2 (RMVX ver.)

#

# Initial Release Date: 2009-03-03 (YYYY-MM-DD)

#

# Note: 'Order' command does not work.

#

#============================================================================

 

module MenuCommand

  #Default menu commands +1

  Item     = 'Item'

  Skill    = 'Skill'

  Equip    = 'Equip'

  Status   = 'Status'

  Save     = 'Save'

  Load     = 'Load'

  End_Game = 'Exit'

  #Optional menu commands

  Order    = 'Order'

  Party    = 'Party'

  Option   = 'Option'

  Quest    = 'Quest'

  System   = 'System'

end

 

#------------------------------------------------------------------------------

#  Game_Map

#------------------------------------------------------------------------------

class Game_Map

#------------------------------------------------------------------------------

#  Name

#------------------------------------------------------------------------------

  def name

    $map_infos[@map_id]

  end

end

 

 

#========================================

#  Scene_Title

#--------------------------------------------------------------------------------

# Setting functions for the Title

#========================================

class Scene_Title

  $map_infos = load_data("Data/MapInfos.rvdata")

  for key in $map_infos.keys

    $map_infos[key] = $map_infos[key].name

  end

end

 

 

class Window_MapName < Window_Base

 def initialize(x, y)

   super(x, y, 240, 64) 

   refresh

 end

 def refresh

   self.contents.clear

   self.contents.font.color = normal_color

   self.contents.draw_text(4, 0, 200, 32, $game_map.name.to_s, 1)

 end

end

 

 

#==============================================================================

# Window_Gold

#==============================================================================

 

class Window_Gold < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization 

  #--------------------------------------------------------------------------

  def initialize(x, y)

    super(x, y, 200, 64)

    #Refresh and add the contents to window

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh 

  #--------------------------------------------------------------------------

  def refresh

    #Advanced Gold Display mini-script by Dubealex.

    self.contents.clear     

    case $game_party.gold

    when 0..9999

      gold = $game_party.gold

    when 10000..99999

      gold = $game_party.gold.to_s

      array = gold.split(//)

      gold = array[0].to_s+array[1].to_s+","+array[2].to_s+array[3].to_s+array[4].to_s

    when 100000..999999 

      gold = $game_party.gold.to_s

      array = gold.split(//)

      gold = array[0].to_s+array[1].to_s+array[2].to_s+","+array[3].to_s+array[4].to_s+array[5].to_s

    when 1000000..9999999 

      gold = $game_party.gold.to_s

      array = gold.split(//)

      gold = array[0].to_s+","+array[1].to_s+array[2].to_s+array[3].to_s+","+array[4].to_s+array[5].to_s+array[6].to_s

    end

  

    self.contents.font.color = system_color 

    gold_word = $data_system.terms.gold.to_s + " /"

    cx = contents.text_size(gold_word).width

    cx2=contents.text_size(gold.to_s).width

    self.contents.draw_text(4, 0, 160-cx-2, 32, gold_word)

    self.contents.font.color = text_color(0) 

    self.contents.draw_text(164-cx2+2, 0, cx2, 32, gold.to_s, 2)

  end

end

 

 

#==============================================================================

# ** Window_MenuStatus

#------------------------------------------------------------------------------

#  This window displays party member status on the menu screen.

#==============================================================================

 

class Window_MenuStatus < Window_Selectable

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     x : window X coordinate

  #     y : window Y coordinate

  #--------------------------------------------------------------------------

  def initialize(x, y)

    $game_party.members.size < 4 ? i = 14 : i = 0

    $game_party.members.size == 1 ? i = WLH : i = i

    super(x, y, 384, ($game_party.members.size * 72)+i)

    refresh

    self.active = false

    self.index = -1

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    @item_max = $game_party.members.size

    for actor in $game_party.members

      x = 16

      y = actor.index*64

      draw_actor_name(actor, x, y)

      draw_actor_class(actor, x + 120, y)

      draw_actor_level(actor, x, y + WLH * 1)

      draw_actor_state(actor, x + 220, y)

      draw_actor_hp(actor, x + 72, y + WLH * 1)

      draw_actor_mp(actor, x + 200, y + WLH * 1)

    end

  end

  #--------------------------------------------------------------------------

  # * Update cursor

  #--------------------------------------------------------------------------

  def update_cursor

    if @index < 0               # No cursor

      self.cursor_rect.empty

    elsif @index < @item_max    # Normal

      self.cursor_rect.set(0, @index * 64, contents.width, 64)

    elsif @index >= 100         # Self

      self.cursor_rect.set(0, (@index - 100) * 64, contents.width, 64)

    else                        # All

      self.cursor_rect.set(0, 0, contents.width, @item_max * 64)

    end

  end

end

 

 

 

#==============================================================================

# ** 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

    commands_init

    @changer = 0 #Change Party Order by Yargovish

    @where = 0 #

    @checker = 0  #

  end

  #--------------------------------------------------------------------------

  # * Set Commands

  #--------------------------------------------------------------------------

  def commands_init

    @commands = []

    s1 = MenuCommand::Item

    s2 = MenuCommand::Skill

    s3 = MenuCommand::Equip

    s4 = MenuCommand::Status

    s5 = MenuCommand::Party

    s6 = MenuCommand::System

    @commands.push(s1, s2, s3, s4, s5, s6).flatten!

    

    @sys_commands = []

    o1 = MenuCommand::Option

    o2 = MenuCommand::Save

    o3 = MenuCommand::Load

    o4 = MenuCommand::End_Game

    @sys_commands.push(o1, o2, o3, o4).flatten!

  end

  #--------------------------------------------------------------------------

  # * Start processing

  #--------------------------------------------------------------------------

  def start

    super

    create_menu_background

    create_command_window

    create_system_window

    @gold_window = Window_Gold.new(344, 352)

    @status_window = Window_MenuStatus.new(160, 0)

    @mapname_window = Window_MapName.new(0, 352)

  end

  #--------------------------------------------------------------------------

  # * Termination Processing

  #--------------------------------------------------------------------------

  def terminate

    super

    dispose_menu_background

    @command_window.dispose

    @sys_command_window.dispose

    @gold_window.dispose

    @status_window.dispose

    @mapname_window.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    super

    update_menu_background

    @command_window.update

    @sys_command_window.update

    @gold_window.update

    @status_window.update

    @mapname_window.update

    if @command_window.active

      update_command_selection

    elsif @sys_command_window.active

      @sys_command_window.z = +500

      update_sys_command_selection

    elsif @status_window.active

      update_actor_selection

    end

  end

  #--------------------------------------------------------------------------

  # * Create Command Window

  #--------------------------------------------------------------------------

  def create_command_window

    @command_window = Window_Command.new(160, @commands)

    @command_window.index = @menu_index

    if $game_party.members.size == 0          # If number of party members is 0

      @command_window.draw_item(0, false)     # Disable item

      @command_window.draw_item(1, false)     # Disable skill

      @command_window.draw_item(2, false)     # Disable equipment

      @command_window.draw_item(3, false)     # Disable status

    end   

    #if $game_party.members.size <= 1

    #  @command_window.draw_item(4, false)     # Disable ordering

    #end

  end

  #--------------------------------------------------------------------------

  # * Create System Command Window

  #--------------------------------------------------------------------------

  def create_system_window

    @sys_command_window = Window_Command.new(128, @sys_commands)

    @sys_command_window.visible = false

    @sys_command_window.active = false

    @sys_command_window.x = 100

    @sys_command_window.y = 130

    @sys_command_window.z = 0

    check_save_available

    check_load_available

  end

  #-----------------

  def check_save_available

    if $game_system.save_disabled             # If save is forbidden

      @sys_command_window.draw_item(1, false)     # Disable save

    end

  end

  #-----------------

  def check_load_available

    #Check if saved file exists

    @load_enabled = (Dir.glob('Save*.rvdata').size > 0)

    if !@load_enabled

      #Put your @command_window.draw_item(index, false) to disable load

      @sys_command_window.draw_item(2, false)

    end

  end

  #--------------------------------------------------------------------------

  # * Update Command Selection

  #--------------------------------------------------------------------------

  def update_command_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      $scene = Scene_Map.new

    elsif Input.trigger?(Input::C)

      # Return if Disabled Command

      if disabled_main_command?

        # Play buzzer SE

        Sound.play_buzzer

        return

      end

      main_command_input

    end

  end

  #--------------------------------------------------------------------------

  # * Update Command Selection

  #--------------------------------------------------------------------------

  def update_sys_command_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      @command_window.active = true

      @sys_command_window.active = false

      @sys_command_window.visible = false

      @sys_command_window.index = 0

      @sys_command_window.z = -500

      return

    elsif Input.trigger?(Input::C)

      # Return if Disabled Command

      if disabled_main_command?

        # Play buzzer SE

        Sound.play_buzzer

        return  

      end

      sys_command_input

    end

  end

  #--------------------------------------------------------------------------

  # * Disabled Main Command? Test

  #--------------------------------------------------------------------------

  def disabled_main_command?

    # Gets Current Command

    command = @commands[@command_window.index]

    sys_command = @sys_commands[@sys_command_window.index]

    # Gets Menu Commands

    c = MenuCommand

    # If 0 Party Size

    if $game_party.members.size == 0

      # If Item, Skill, Equip or Status Selected

      if [c::Item, c::Skill, c::Equip, c::Status].include?(command)

        return true

      end

    elsif $game_party.members.size <= 1

      # If the command is changing member order

      if [c::Order].include?(command)

        return true

      end

    end

    # If Save Disabled && Command is Save

    return true if $game_system.save_disabled and sys_command == c::Save

    # If Load Disabled && Command is Load

    return true if !@load_enabled && sys_command == c::Load

    return false

  end

  #--------------------------------------------------------------------------

  # * Update Command Check

  #--------------------------------------------------------------------------

  def main_command_input

    # Loads Current Command

    command = @commands[@command_window.index]

    # Play decision SE

    Sound.play_decision

    # Checks Commands

    case command

    when MenuCommand::Item  #item

      command_item

    when MenuCommand::Skill, MenuCommand::Equip, MenuCommand::Status #skill, equip, status

      start_actor_selection   

    when MenuCommand::Order #order

      command_order

    when MenuCommand::Party

      command_party

    when MenuCommand::System  #call system submenu

      @sys_command_window.active = true

      @sys_command_window.visible = true

      @command_window.active = false      

    end

  end

  #--------------------------------------------------------------------------

  # * Update System Command Check

  #--------------------------------------------------------------------------

  def sys_command_input

    # Loads Current Command

    sys_command = @sys_commands[@sys_command_window.index]

    # Play decision SE

    Sound.play_decision

    # Checks Commands

    case sys_command

    when MenuCommand::Option  #option

      command_option

    when MenuCommand::Save  #save

      command_save

    when MenuCommand::Load  #load

      command_load

    when MenuCommand::End_Game  #exit

      command_endgame

    end

  end

  #--------------------------------------------------------------------------

  # * Start Actor Selection

  #--------------------------------------------------------------------------

  def start_actor_selection

    @command_window.active = false

    @status_window.active = true

    if $game_party.last_actor_index < @status_window.item_max

      @status_window.index = $game_party.last_actor_index

    else

      @status_window.index = 0

    end

  end

  #--------------------------------------------------------------------------

  # * End Actor Selection

  #--------------------------------------------------------------------------

  def end_actor_selection

    @command_window.active = true

    @status_window.active = false

    @status_window.index = -1

  end

  #--------------------------------------------------------------------------

  # * Update Actor Selection

  #--------------------------------------------------------------------------

  def update_actor_selection

    # Loads Current Command

    command = @commands[@command_window.index]

    if Input.trigger?(Input::B)

      Sound.play_cancel

      end_actor_selection

    elsif Input.trigger?(Input::C)

      $game_party.last_actor_index = @status_window.index

      Sound.play_decision

      case command

      when MenuCommand::Skill  # skill

        command_skill

      when MenuCommand::Equip  # equipment

        command_equip

      when MenuCommand::Status  # status

        command_status

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Command Item

  #--------------------------------------------------------------------------

  def command_item

    # Switch to item screen

    $scene = Scene_Item.new

  end

  #--------------------------------------------------------------------------

  # * Command Skill

  #--------------------------------------------------------------------------

  def command_skill

    # Switch to skill screen

    $scene = Scene_Skill.new(@status_window.index)

  end

  #--------------------------------------------------------------------------

  # * Command Equip

  #--------------------------------------------------------------------------

  def command_equip

    # Switch to equipment screen

    $scene = Scene_Equip.new(@status_window.index)

  end

  #--------------------------------------------------------------------------

  # * Command Status

  #--------------------------------------------------------------------------

  def command_status

    # Switch to status screen

    $scene = Scene_Status.new(@status_window.index)

  end

  #--------------------------------------------------------------------------

  # * Command Order

  #--------------------------------------------------------------------------

  def command_order

    # If Main Command Active

    if @command_window.active

      # Activate Status Window

      start_actor_selection

      @checker = 0

      return

    end

    #Change Party Order by Yargovish

    if @checker == 0

      @changer = $game_party.members[@status_window.index]

      @where = @status_window.index

      @checker = 1

    else

      $game_party.members[@where] = $game_party.members[@status_window.index]

      $game_party.members[@status_window.index] = @changer

      @checker = 0

      @status_window.refresh

      $game_player.refresh #

    end      

  end

  #--------------------------------------------------------------------------

  # * Command Party

  #--------------------------------------------------------------------------

  def command_party

    # Switch to party change screen

    #Put your Party Change Scene here

  end

  #--------------------------------------------------------------------------

  # * Command Option

  #--------------------------------------------------------------------------

  def command_option

    # Switch to party change screen

    #Put your Option Scene here

  end

  #--------------------------------------------------------------------------

  # * Command Quest

  #--------------------------------------------------------------------------

  def command_quest

    # Switch to party change screen

    #Put your Quest Scene here

  end

  #--------------------------------------------------------------------------

  # * Command Save

  #--------------------------------------------------------------------------

  def command_save

    # Switch to save screen

    $scene = Scene_File.new(true, false, false)

  end

  #--------------------------------------------------------------------------

  # * Command Load

  #--------------------------------------------------------------------------

  def command_load

    # Switch to load screen

    $scene = Scene_File.new(false, false, false)

  end

  #--------------------------------------------------------------------------

  # * Command End Game

  #--------------------------------------------------------------------------

  def command_endgame

    # Switch to end game screen

    $scene = Scene_End.new

  end

end

 

Instructions

This is basically 'copy & paste' script. For 'dummied' custom commands like 'party change' or 'option', you have to use other scripts for making it functional.

FAQ

Q: Huh? 'Order'?
A: Changing party members' order around. Unfortunately, it does not work. In XP, I used Yargovish's code, however in VX, dispite of no syntax error, I cannot make it work.

Compatibility

Of course, it does replace main menu, so it won't work with other CMS.

Credits and Thanks

Dubealex for gold display mini script.
And for other scripters for showing me how-to-do.

Authoress' Notes

Now that I'm away from the scene, maybe there won't be enough support for my scripts.

Terms and Conditions

Feel free to use. Credits would be fine.
 

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