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.

Showing Equipment in MenuStatus Window

I am almost done with my custom menu for my game and everything has gone well up until now. What I want is to display what the character has equipped underneath where I have his HP and MP. The way I have my menu set up sort of disallows the use of regular syntax, because I am only using one character and Window_MenuStatus isn't set up to handle multiple actors. I just need some help getting the equipment for Actor 1, showing up in Window_MenuStatus.

I have tried copying it from Window_Status, but I get method errors out the bunghole. So how do I go about doing this? Here is my MenuStatus script:
Code:
#==============================================================================
# ** 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)
    super(x, y, 384, 416)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    actor = $game_actors[1]
    @item_max = $game_party.members.size
    for actor in $game_party.members
    self.contents.font.color = normal_color
    self.contents.font.size = 28
    self.contents.draw_text(0, 0, 200, 32, 'Banjara')
    self.contents.font.size = 24
    self.contents.draw_text(0, 22, 200, 32, 'Lv.')
    self.contents.draw_text(28, 22, 200, 32, $game_actors[1].level.to_s)
    self.contents.draw_text(0, 68, 60, 32, 'HP')
    self.contents.draw_text(0, 96, 60, 32, 'MP')
    self.contents.draw_text(0, 124, 60, 32, 'SP')
    draw_hp(1, 32, 68)
    draw_mp(1, 32, 96)
    draw_sp(32, 124)
  end
end
  #--------------------------------------------------------------------------
  # * Draw HP, MP, and SP Bars
  #-------------------------------------------------------------------------- 
def draw_hp(actor, x, y)
  back = Cache.system('MenuBarBase')
  cw = back.width
  ch = back.height
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x, y-ch+24, back, src_rect)
  meter = Cache.system('MenuHPBar')
  cw = meter.width  * $game_actors[1].hp / $game_actors[1].maxhp
  ch = meter.height
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x, y+5, meter, src_rect)
end  
def draw_mp(actor, x, y)
  back = Cache.system('MenuBarbase')    
  cw = back.width
  ch = back.height
  src_rect = Rect.new(0, 0, cw, ch)    
  self.contents.blt(x, y-ch+24, back, src_rect)
  meter = Cache.system('MenuMPBar')    
  cw = meter.width  * $game_actors[1].mp / $game_actors[1].maxmp
  ch = meter.height 
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x, y+5, meter, src_rect)
end
def draw_sp(x, y)
  back = Cache.system('MenuBarBase')    
  cw = back.width
  ch = back.height
  src_rect = Rect.new(0, 0, cw, ch)    
  self.contents.blt(x, y-ch+24, back, src_rect)
  meter = Cache.system('MenuSPBar')    
  cw = meter.width  * $game_variables[1] / 100
  ch = meter.height 
  src_rect = Rect.new(0, 0, cw, ch)
  self.contents.blt(x, y+5, meter, src_rect)
end
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0               # No cursor
      self.cursor_rect.empty
    elsif @index < @item_max    # Normal
      self.cursor_rect.set(-4, @index * 96, 358, 54)
    elsif @index >= 100         # Self
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                        # All
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
  end
end

The reason it isn't following the usual syntax is because I was trying to be VERY specific with how it looked according to my mock ups(which, so far, it looks almost identical). The only original aspect of MenuStatus that remains is being able to select the character to go to the other menus.

Thanks in advance.
 

khmp

Sponsor

This is for VX right? Just work in the draw_equipments method from the Window_Status class into your Window_MenuStatus class. You might need to alter it to either take in another local variable(actor) or make the actor you get in the refresh method an instance variable. Ex:

Code:
actor = $game_actors[1]
becomes...
Code:
@actor = $game_actors[1]

And be careful with your looping in the refresh method. If you are only drawing the party leader or a specific actor you don't need any looping behavior. Otherwise you are just redrawing the same information multiple times. I hope you get what I mean.

Good luck with it Bernard!  :thumb:
 

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