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.

Simplified Menu Script (resolved)

So, basically what I'd like, is just a menu that only has two options:
Items
End Game

And have these at the top, then below it have the character's sprite in walking animation, with their HP (and only their HP) beside them.

Thanks, and I do have acess to the SDK, if needed =D.
 

Twirly

Sponsor

I still don't know how to make the walking char but here you go your menu version 0.9:
Code:
#######################################################################
# Simplified Menu v 0.9
# Author: Asdren ( also known as Indian Giver or Herr Frederick Von Twirlenkiller)
# Release: August 2008
# Thanks to Rathalos for requesting it.
#######################################################################
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 240, 340)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 88
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 45)
      draw_actor_hp(actor, x - 0, y + 12)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
    end
  end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2])
    @command_window.index = @menu_index
    @command_window.x = 237
    @command_window.y = 0
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
    end
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 200
    @status_window.y = 105
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
Hope you like it :thumb:
PS: Please credit asdren (that's still me)
 
Hmm... I put it above main (is that right? =P) and I got this error:

Script "Window_Base" line 109: NoMethodError occured
undefined method "character Name" for #<Array:0x146e1a0)

=P
Thanks for putting the time into making that, but is there a way I can fix this? Thanks again =D.
 

Twirly

Sponsor

Try this:
Code:
#######################################################################
#Simplified Menu v0.9 by Asdren
#Tahnks to Rathalos for requesting the script XD
#Release:2008
#######################################################################
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 240, 340)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 64
      y = i * 88
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 45)
      draw_actor_hp(actor, x - 0, y + 12)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
    end
  end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2])
    @command_window.index = @menu_index
    @command_window.x = 237
    @command_window.y = 0
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
    end
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 200
    @status_window.y = 105
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end
 
Few questions (maybe just 1 really...)
Do you want to have this menu completely on its own? Say, with a dark background? or would you like something on the background
 
The map of the game in the backround would be nice, if possible (like, the map behind the screen), but not needed. And to answer a question asked a bit ago: yes, I would like the gold to show up, not the steps though >_<.
 
Seems like that'll be extremely empty...but oh well, here it is
Code:
class Scene_Menu
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  
  def main
    make_menu_window
    @spriteset = Spriteset_Map.new
    @menu_window.index = @menu_index
    @animation_window = Window_Animation.new
    @info_window = Window_Info.new
    Graphics.transition
    loop do
      Input.update
      Graphics.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @menu_window.dispose
    @animation_window.dispose
    @info_window.dispose
    @spriteset.dispose
  end
  
  def update
    @animation_window.refresh
    @menu_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      case @menu_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      end
    end
  end
  
  def make_menu_window
    s1 = "Items"
    s2 = "End Game"
    @commands = [s1,s2]
    @menu_window = Window_Command.new(160,@commands)
    @menu_window.active = true
  end
end

class Window_Animation < Window_Base
  def initialize 
    super(160,0,480,480)
    self.contents = Bitmap.new(width - 32, height - 32)
    @frame = 0
    @frames = 0
    @frame_count = Graphics.frame_count
    @frame_width = 0
    @frame_height = 0
    refresh
  end
  
  def refresh
    self.contents.clear
    for i in 0...$game_party.actors.size
      @actor = $game_party.actors[i]
      @bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
      x = 0
      y = 112* i + 5
      unless @actor == nil
        get_settings
        time = Graphics.frame_count - @frame_count
        if time >= 10
          @frame_count = Graphics.frame_count
          rx = (@frame%4)*@frame_width
          rect = Rect.new(rx,0,@frame_width,@frame_height)
          self.contents.blt(x,y,@bitmap,rect,255)
          @frame += 1
          if @frame == @frames
            @frame = 0
          end
        else
          rx = (@frame%4)*@frame_width
          ry = (@frame)%4*@frame_height
          rect = Rect.new(rx,0,@frame_width,@frame_height)
          self.contents.blt(x,y,@bitmap,rect,255)
        end
      end
    end
  end
  
  def get_settings
    @frame_height = @bitmap.height/4
    @frame_width = @bitmap.width/4
    @frames = (@bitmap.height/@frame_height)*(@bitmap.width/@frame_width)
  end
end

class Window_Info < Window_Base
  def initialize
    super(160,0,480,480)
    self.back_opacity = 0
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    for i in 0...$game_party.actors.size
      self.contents.font.color = system_color
      self.contents.draw_text(50,110*i + 32,100,32,"HP: ")
      self.contents.font.color = normal_color
      actor = $game_party.actors[i]
      self.contents.draw_text(50,110*i,100,32,actor.name)
      self.contents.draw_text(100,110*i + 32,500,32,actor.hp.to_s + "/" + 
                              actor.maxhp.to_s)
    end
  end
end

class Scene_End
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update command window
    @command_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(1)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # to title
        command_to_title
      when 1  # shutdown
        command_shutdown
      when 2  # quit
        command_cancel
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # *  Process When Choosing [Cancel] Command
  #--------------------------------------------------------------------------
  def command_cancel
    # Play decision SE
    $game_system.se_play($data_system.decision_se)
    # Switch to menu screen
    $scene = Scene_Menu.new(1)
  end
end
should be fully plug-n-play, but it MIGHT cause a problem with classes that overwrite Scene_End and WILL cause a problem with classes that overwrite Scene_Menu.
To be safest, put this under any other custom scripts and above main
 
zech04":18ehuvn9 said:
theres a simplified menu in resources check might be new
That's the one here that was posted before berans. it doesn't work for me for whatever reason.

Anyway, thanks Baran, it works great =D. No errors yet XD.

And thanks Asdren too, don't know why my XP is t3h broke, but whatever. At least some people are using your script. Good job.

Also, I'm surprised someone answered this O_o. Now if someone could actually get me one part of my resources >_<.
 

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