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] MenuStatus rect

Hi, i am making a game with 10 battle party members and i tried to redo the menustatus window in order to make all them appear in just one page but i have a problem

The selection rect is too big ç_ç and it will scroll down to the tenth index.
I tried in all way to resize that selection rect, but i failed T_T can anyone help me?
how can i resize it? it should have 45 height
 

khmp

Sponsor

Play around with the constant until you get the result you want. In my opinion 45 might still be too large if you are fitting 10 items in the window at one time. Thinking about it you have 416, screen height, minus 32, window border height which leaves you with, 384 to be split across 10 ways. That means you will have 38.4 for each object. So you might be better off with 38 but I wish the remainder wasn't so large. It does divide by 6 and 8 evenly.

Code:
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  Item_Height = 45
  #--------------------------------------------------------------------------
  # * 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 * Item_Height, contents.width, 
        Item_Height)
    elsif @index >= 100         # Self
      self.cursor_rect.set(0, (@index - 100) * Item_Height, contents.width, 
        Item_Height)
    else                        # All
      self.cursor_rect.set(0, 0, contents.width, @item_max * Item_Height)
    end
  end
end

Good luck with it wrathchild! :thumb:
 
mmh.. nothing to do T_T

here's the full menustatus code.
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
   
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  Item_Height = 45

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      x = 0
      y = actor.index * 40
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x+90, y)
      draw_actor_level(actor, x+160, y)
      draw_actor_state(actor, x+200, y)
      draw_actor_hp(actor, x+220 , y )
      draw_actor_mp(actor, x+220 , y+15 )
      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 * Item_Height, contents.width, 
        Item_Height)
    elsif @index >= 100         # Self
      self.cursor_rect.set(0, (@index - 100) * Item_Height, contents.width, 
        Item_Height)
    else                        # All
      self.cursor_rect.set(0, 0, contents.width, @item_max * Item_Height)
    end
  end    

end

what's wrong?
 

khmp

Sponsor

First and most importantly. Any code that anyone gives you here shouldn't replace the default code. Never ever edit the default classes unless the person tells you specifically to do it. The way you should have installed what I gave you is inserted an empty section at that "(Insert Here)" line so that it lies just below "Materials". So please restore the Window_MenuStatus code to the way it was and insert an empty section under materials for the code I gave you. There is one minuscule problem that you have with the code you posted if it's in fact exactly what you have in the editor. If you begin a script with an equals, "=", you are commenting the whole thing out. Add in that pound sign before the first line to remedy this.
Code:
#==============================================================================
instead of:
Code:
==============================================================================

Good luck with it wrathchild! :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