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.

Need a simple in game menu

I am using RPGMVX not RPGXP
Script Request Template
This is a request for a new script, an edit or debug of an existing script.

In game Menu

Detailed Description:
Ok I'm making an adventure game. there will be no battle system in my game. So I only need a simple menu that dose not show the stats of the character. I only want to be able to access to Items menu, Achievement menu (Achievements System Script by Omegas7)and lets the player save and exit the game.

Achievement menu is $scene = Omegas_Achievements_Scene.new

Screen shots:
This is just a crappy photoshop image of what I'm looking for.
Untitled-1-1.jpg


Other Scripts I am using (in order):
Custom Commands by Dargor.
Map Name Popup by Dargor
Achievements System Script by Omegas7
Light Effects VX 1.1 by Kylock
Achievement CMC by me used to show Achievement menu is main menu.
 
I made this one, hope its what you want
Code:
#==============================================================================

# ** Custom Menu

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

#  Made by Sheol

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

 

class Scene_Menu

 

  class Window_MenuCommand < Window_Selectable

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

    def initialize

      super(32, 32, 576, 64)

      self.contents = Bitmap.new(544, 32)

      @item_max = @column_max = 4

      @commands = %w( Inventory Missions Save Exit )

      refresh

      self.index = 0

    end

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

    def refresh

      self.contents.clear

      0.upto(@item_max-1) { |i| draw_item(i, false) }

    end

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

    def draw_item(index, color)

      self.contents.font.color = color ? disabled_color : normal_color

      self.contents.draw_text(index * 144 + 4, 0, 112-8, 32, @commands[index], 1)

    end

  end

  

  class Window_MenuItem < Window_Item

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

    def initialize

      super

      self.active = false

      self.x = 32

      self.y = 96

      self.width = 576

      self.height = 352

      refresh

      update_cursor_rect

    end

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

    def draw_item(index)

      item = @data[index]

      case item

      when RPG::Item

        number = $game_party.item_number(item.id)

      when RPG::Weapon

        number = $game_party.weapon_number(item.id)

      when RPG::Armor

        number = $game_party.armor_number(item.id)

      end

      if item.is_a?(RPG::Item) and

        $game_party.item_can_use?(item.id)

        self.contents.font.color = normal_color

      else

        self.contents.font.color = disabled_color

      end

      x = 4 + index % 2 * (256 + 32)

      y = index / 2 * 32

      rect = Rect.new(x, y, self.width / @column_max - 32, 32)

      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

      bitmap = RPG::Cache.icon(item.icon_name)

      opacity = self.contents.font.color == normal_color ? 255 : 128

      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)

      self.contents.draw_text(x + 28, y, 212 - 32, 32, item.name, 0)

      self.contents.draw_text(x + 240 - 32, y, 16, 32, ":", 1)

      self.contents.draw_text(x + 256 - 32, y, 24, 32, number.to_s, 2)

    end

  end

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

  def main

    @command_window = Window_MenuCommand.new

 

    if $game_system.save_disabled

      @command_window.draw_item(2, true)

    end

    

    @item_window = Window_MenuItem.new

    

    @target_window = Window_Target.new

    @target_window.visible = false

    @target_window.active = false

    

    @dummy_window = Window_Base.new(32, 96, 576, 352)

    @dummy_window.z += 100

    

    Graphics.transition

    while $scene == self

      Graphics.update

      Input.update

      update

    end

    Graphics.freeze

    @command_window.dispose

    @item_window.dispose

    @target_window.dispose

    @dummy_window.dispose

  end

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

  def update

    if @item_window.active

      update_item

      return

    elsif @target_window.active

      update_target

      return

    end

    

    @command_window.update

    @dummy_window.visible = @command_window.index != 0

  

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      $scene = Scene_Map.new

      return

    end

    

    if Input.trigger?(Input::C)

      case @command_window.index

      when 0

        $game_system.se_play($data_system.decision_se)

        @item_window.active = true

        @command_window.active = false

      when 1

        $game_system.se_play($data_system.decision_se)

        # Missions

        $scene = Omegas_Achievements_Scene.new

      when 2

        if $game_system.save_disabled

          $game_system.se_play($data_system.buzzer_se)

          return

        end

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_Save.new

      when 3

        $game_system.se_play($data_system.decision_se)

        $scene = Scene_End.new

      end

    end

  end

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

  def update_item

    @item_window.update

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      @item_window.active = false

      @command_window.active = true

      return

    end

    

    if Input.trigger?(Input::C)

      @item = @item_window.item

      unless @item.is_a?(RPG::Item)

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      unless $game_party.item_can_use?(@item.id)

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      $game_system.se_play($data_system.decision_se)

      if @item.scope >= 3

        @item_window.active = false

        @target_window.x = (@item_window.index + 1) % 2 * 304

        @target_window.visible = true

        @target_window.active = true

        if @item.scope == 4 || @item.scope == 6

          @target_window.index = -1

        else

          @target_window.index = 0

        end

      else

        if @item.common_event_id > 0

          $game_temp.common_event_id = @item.common_event_id

          $game_system.se_play(@item.menu_se)

          if @item.consumable

            $game_party.lose_item(@item.id, 1)

            @item_window.draw_item(@item_window.index)

          end

          $scene = Scene_Map.new

        end

      end

    end

  end

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

  def update_target

    @target_window.update

 

    if Input.trigger?(Input::B)

      $game_system.se_play($data_system.cancel_se)

      unless $game_party.item_can_use?(@item.id)

        @item_window.refresh

      end

      @item_window.active = true

      @target_window.visible = false

      @target_window.active = false

      return

    end

    if Input.trigger?(Input::C)

      if $game_party.item_number(@item.id) == 0

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      if @target_window.index == -1

        used = false

        for i in $game_party.actors

          used |= i.item_effect(@item)

        end

      end

      if @target_window.index >= 0

        target = $game_party.actors[@target_window.index]

        used = target.item_effect(@item)

      end

      if used

        $game_system.se_play(@item.menu_se)

        if @item.consumable

          $game_party.lose_item(@item.id, 1)

          @item_window.draw_item(@item_window.index)

        end

        @target_window.refresh

        if $game_party.all_dead?

          $scene = Scene_Gameover.new

          return

        end

        if @item.common_event_id > 0

          $game_temp.common_event_id = @item.common_event_id

          $scene = Scene_Map.new

          return

        end

      end

      unless used

        $game_system.se_play($data_system.buzzer_se)

      end

    end

  end

end

 
 
It must be something to do with the other scripts.
because when I add the new line of code I get
script ' 'line41: NameError occurred
undefined local variable or method'update_cursor_rect'for
#<Scene_Menu::window_MenuItem:0x2e14e70>

Could it be a position problem, I have it below Custom Commands Dargor above my other scripts
Map Name Popup by Dargor
Achievements System Script by Omegas7
Light Effects VX 1.1 by Kylock
Achievement CMC by me used to show Achievement menu is main menu.
 
if you want send me your project in a private message and I'll find the problem

Oh, big problem... I thought it was for rmXP :crazy:

I cant make it work for VX, I doesnt have it anymore :/
 

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