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.

[VX] Compact Menu System

Compact Menu System
v1.0

Introduction
This script is a very compact CMS, similar to the one I used in castorvian legends - but for VX!
This script was basically to get me into RGSS2 more than anything so I can start makin' some VX scripts.

Screenshot
http://shadowruby.co.uk/vxcompactmenu.PNG[/img]

Script
Code:
#==============================================================================
#  Compact Custom Menu System
#         RMVX Version
#            v1.0
#         by  Rubymatt
#==============================================================================


#==============================================================================
# ** NEW Window_Gold
#==============================================================================

class Window_Gold < Window_Base
  def initialize(x, y)
    super(x, y, 224, WLH + 32)
    refresh
  end
  def refresh
    self.contents.clear
    draw_currency_value($game_party.gold, 4, 0, 184)
  end
end

#==============================================================================
# ** NEW Window_MenuStatus
#==============================================================================

class Window_NewMenuStatus < Window_Selectable
  def initialize(x, y)
    super(0, 0, 64, $game_party.members.size * 36 + 32)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      x = 66
      y = actor.index * 36
      draw_actor_graphic(actor, x - 51, y + 32)
    end
  end
  def update_cursor
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(-2, @index * 36 - 2, 36, 36)
    end
  end
end

#==============================================================================
# ** NEW Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  def start
    super
    create_menu_background
    create_command_window
    @gold_window = Window_Gold.new(160, 248)
    @status_window = Window_NewMenuStatus.new(160, 0)
    @status_window.x = 320
    if $game_party.members.size == 4
      @status_window.y = 72
    elsif $game_party.members.size == 3
      @status_window.y = 88
    elsif $game_party.members.size == 2
      @status_window.y = 104
    elsif $game_party.members.size == 1
      @status_window.y = 120
    else
      @status_window.y = 72
    end
  end
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  def update
    super
    update_menu_background
    @command_window.update
    @gold_window.update
    @status_window.update
    if @command_window.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.x = 160
    @command_window.y = 72
    @command_window.height = 176
    @command_window.index = @menu_index
    if $game_party.members.size == 0        
      @command_window.draw_item(0, false)   
      @command_window.draw_item(1, false)   
      @command_window.draw_item(2, false)     
      @command_window.draw_item(3, false)     
    end
    if $game_system.save_disabled             
      @command_window.draw_item(4, false)   
    end
  end
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      
        $scene = Scene_Item.new
      when 1,2,3  
        start_actor_selection
      when 4      
        $scene = Scene_File.new(true, false, false)
      when 5    
        $scene = Scene_End.new
      end
    end
  end
  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
  def end_actor_selection
    @command_window.active = true
    @status_window.active = false
    @status_window.index = -1
  end
  def update_actor_selection
    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_window.index
      when 1 
        $scene = Scene_Skill.new(@status_window.index)
      when 2 
        $scene = Scene_Equip.new(@status_window.index)
      when 3  
        $scene = Scene_Status.new(@status_window.index)
      end
    end
  end
end

Notes
You have to have at least one person in the party at any time, or the scriipt will fail.  To be honest, I wouldn't see the point in a menu if there was nobody in the party, so make sure menu is DISABLED at all times if you ever, for some reason, end up in this situation.

That's all there is.  Place above main, below Materials.  No need for a demo, it really is that simple to install.

Give credit, and feedback.  ^_^

EDIT: Script updated, had a bug with the status window.  Fxied.
EDIT2: Updated again, fixed a glitch when calling the menustatus in the Item Menu
EDIT3: Fixed the next big glitch mentioned in the posts below.
 
looks pretty cool... i personally would have thought it'd look better in one of the bottom corners but thats piss easy to do anyway XD... i think this would work well for an advanced game that runs the tilemap continously while the menu is open... that way you can access the menu while time continues ot pass.. like an online game
 
Hm, this looks really nice as is, though I wonder if it can be messed around with to support more menu options/large party scripts. If this is possible (and the background is changeable), then this is a fantastic menu.
 
it can be messed around with... easily... its just a menu...
even someone with absolutely no scriptign knowledge can EDIT menus... they are easy as hell
 
In the future, I may release a large-party edit for it, and custom options are very easy to do in this menu.  The only thing that may be a problem is height, but that can easily be sorted in one line that I didn't add because it wasn't needed by default.

I'm gonna put the line in now, and then you can have as many options as you like.

Edit: Done, now the window will always be the same height no matter how many commands are in it.
 
if you REAAALLLLY need help making this cutomisable (like you change 1 value and everything is resized aroudn that value) then just ask... i code about 90% of the time now and have been doing so for about 3 weeks... ive already rebuilt the input, audio, window, vx patcher (shhh... no i havnt) and other classes during that time and im happy to do more... but the window class rewrite is for xp only im afraid... and me... ITS MINE
 
Still an error with the menu status.

"Line 67: NameError occured
uninitialized constant Scene_Menu:NewWindow_MenuStatus"
 

encen

Member

sorry to bug, but i have the same problem as Psiclone ^_^'
I new with ruby... heh, maybe I should learn ruby. and yes,
I am an idiot most times  :grin:
 

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