Hi, im modifiyng this class. I copy-pasted it to a new one for my golems system. My problem is that in some strange bug, it isnt showing the entire list of items it have.
Note that i checked that the items are pushed in the list or if they erased in some moment: No.
It shows the first element and the nil one, and the second no, but it exist in the @data and the the draw item method at least its called 2 times and correctly extracting the items i want.
Note that also it dont let you navigate in anything.
For the golems system i use pieces to equip and not armor o weapons. The pieces are items that are configured to act with a different behavior using exceptions, etc.
Note that i checked that the items are pushed in the list or if they erased in some moment: No.
It shows the first element and the nil one, and the second no, but it exist in the @data and the the draw item method at least its called 2 times and correctly extracting the items i want.
Note that also it dont let you navigate in anything.
For the golems system i use pieces to equip and not armor o weapons. The pieces are items that are configured to act with a different behavior using exceptions, etc.
Code:
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_GolemEquipItem < Window_Selectable
attr_accessor :slot_index
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type, slot_index=0)
if actor.is_golem?
super(0, 256, 272, 224)
else
super(0, 256, 640, 224)
end
@slot_index = slot_index
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
def test
p @data
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @actor.is_golem?
#p'gol'
# Add equipabble pieces
for i in 1...$data_items.size
# Only add pieces that exist, that are pieces, are equippables for
# the actor and for the slot
#p i, slot_index
#piece_id = Piece.item_piece_id(i)
if $game_party.item_number(i) > 0 and Piece.is_piece?(i)
#p 't'
if Piece.equipable?(@actor.actor_id, i)
#p 'tst', i
#p slot_index, @actor.golemslots[slot_index].type, Piece.item_piece_id(i)
if @actor.golemslots[slot_index].equipable?(i)
#p 'pushed', i
@data.push(Piece.new(Piece.item_piece_id(i)))
end
end
end
end
#p @data
else
# 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
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]
#p 'di', index, item, item.name
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
if @actor.is_golem?
number = item.number
else
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
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)
# originalment, 240, 256
self.contents.draw_text(x + 128, y, 16, 32, ":", 1)
self.contents.draw_text(x + 144, 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