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.

[FILLED] Item window edit

Hey, I was wondering if there is a quick way to make the item window only have one item per row if you know what I mean, rather than having two per row,

Thank You :D
 
You could also change
Code:
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
#to

    self.contents.draw_text(x + 550, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 566, y, 24, 32, number.to_s, 2)

To make it look better. :P
 
Thats great thanks, im using it on my battle system, I have the item/skills window on the bottom right hand side of the screen, but even though its set to one row its got an arrow on the right hand side!

View attachment 566

I don't mind the bottom arrow, its just the arrow on the right hand side that annoys me!

Thank You :D
 
This is the Window Item script, what do i need to do to make it 32 pixels shorter than the windows actual size?

Code:
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 640, 416)
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move the window to bottom left
    if $game_temp.in_battle
      @column_max = 1
      refresh
      self.x = 310 # 310
      self.y = 320 # 64
      self.height = 160 # 256
      self.width = 330 # 360
      self.opacity = 0 # 160
    end
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    # key items start
    for i in 1...$data_items.size
     if $game_party.item_number(i) > 0
     for x in 0...$nonkey_items_ids.size
       if i == $nonkey_items_ids[x]
         @data.push($data_items[i])
       end #ends if to check key items
     end #ends nested loop
     end #ends first if against party having more than 0 of the item
   end #ends outer loop
   # key items end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          @data.push($data_weapons[i])
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          @data.push($data_armors[i])
        end
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  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 * (288 + 32)
    y = index / 2 * 32
    # Makes it only one item per row
    if $game_temp.in_battle
    x = 4
    y = index* 32
    end
    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, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
    # Makes the row longer, 'looks better'
    if $game_temp.in_battle
    self.contents.draw_text(x + 550, y, 16, 32, ":", 1) # 550
    self.contents.draw_text(x + 556, y, 24, 32, number.to_s, 2) # 556
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

Thank You :D
 
Here is your problem:

Code:
  def initialize
    super(0, 64, 640, 416)
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move the window to bottom left
    if $game_temp.in_battle
      @column_max = 1
      refresh
      self.x = 310 # 310
      self.y = 320 # 64
      self.height = 160 # 256
      self.width = 330 # 360
      self.opacity = 0 # 160
    end
  end

Replace that with this:
Code:
  def initialize
    @column_max = 2
    if $game_temp.in_battle
      super(310, 320, 160, 330)
      @column_max = 1
      self.opacity = 0 # 160
    else
      super(0, 64, 640, 416)
    end
    refresh
    self.index = 0
  end

Then, I suggest changing:

Code:
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
# to
    if @column_max == 2
      x = 4 + index % 2 * (288 + 32)
      y = index / 2 * 32
    else
      x = 4
      y = index * 32
    end

That should be it.
 

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