[SOLVED] Equipment colum

Started by TrueCynder, January 20, 2014, 02:17:23 pm

Previous topic - Next topic

TrueCynder

January 20, 2014, 02:17:23 pm Last Edit: January 20, 2014, 06:58:26 pm by TrueCynder
Hey there so i edited the Equipment screen
and i turned the list of useable items in the list ( at the bottom)
into a smaller one colum box.
But it still works as a 2 colum box the items on the ( now left) side are invisable
and the box creats another invisable "item" which then turns into the item that SHOULD be there

Can anyone help me with this please ?  :shy:

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  This window displays choices when opting to change equipment on the
#  equipment screen.
#==============================================================================

class Window_EquipItem < Window_Selectable
 #--------------------------------------------------------------------------
 # * Object Initialization
 #     actor      : actor
 #     equip_type : equip region (0-3)
 #--------------------------------------------------------------------------
 def initialize(actor, equip_type)
   super(272, 256, 368, 224)
   @actor = actor
   @equip_type = equip_type
   @column_max = 1
   refresh
   self.active = false
   self.index = -1
 end
 #--------------------------------------------------------------------------
 # * Item Acquisition
 #--------------------------------------------------------------------------
 def item
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   # Add equippable weapons
   if @equip_type == 0
     weapon_set = $data_classes[@actor.class_id].weapon_set
     for i in 1...$data_weapons.size
       if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
         @data.push($data_weapons[i])
       end
     end
   end
   # Add equippable armor
   if @equip_type != 0
     armor_set = $data_classes[@actor.class_id].armor_set
     for i in 1...$data_armors.size
       if $game_party.armor_number(i) > 0 and armor_set.include?(i)
         if $data_armors[i].kind == @equip_type-1
           @data.push($data_armors[i])
         end
       end
     end
   end
   # Add blank page
   @data.push(nil)
   # Make a bit map and draw all items
   @item_max = @data.size
   self.contents = Bitmap.new(width - 32, row_max * 32)
   for i in 0...@item_max-1
     draw_item(i)
   end
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #     index : item number
 #--------------------------------------------------------------------------
 def draw_item(index)
   item = @data[index]
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   case item
   when RPG::Weapon
     number = $game_party.weapon_number(item.id)
   when RPG::Armor
     number = $game_party.armor_number(item.id)
   end
   bitmap = RPG::Cache.icon(item.icon_name)
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
   self.contents.font.color = normal_color
   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)
 end
 #--------------------------------------------------------------------------
 # * Help Text Update
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.item == nil ? "" : self.item.description)
 end
end

ForeverZer0

The "draw_item" method is still drawing the items as if there are 2 columns.  Setting the column_max property simply determines the behavior of the selector, not how and where items are drawn.

Specifically, you need to edit this part:
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32


This is for a 2 column configuration.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

TrueCynder