Hi again!
So this time I want to sort items based on item_id but I haven't been able to figure out the right method call or where to insert it properly because I either end up with a lot of the same item or a blank sheet of nothing in my window_item
I'm just using the normal window_item class
Where and how can I put which item id's I want to appear in my list. I've tried figuring this out for four hours straight with no justice so I decided to beg for halp again.
My guess is that the method I need should go in here
But heck if I know what to use :blank: I'm so lost
Thanks.
So this time I want to sort items based on item_id but I haven't been able to figure out the right method call or where to insert it properly because I either end up with a lot of the same item or a blank sheet of nothing in my window_item
I'm just using the normal window_item class
Code:
class Window_Recovery_Magical < Window_Selectable
def initialize
super(0, 68, 640, 346)
@column_max = 2
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_item[i])
end
end
@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
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(i)
end
self.contents.font.color = disabled_color
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
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)
face = RPG::Cache.picture("MenuWordBar") rescue nada
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, face, Rect.new(0, 0, 287, 32), opacity)
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)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
Where and how can I put which item id's I want to appear in my list. I've tried figuring this out for four hours straight with no justice so I decided to beg for halp again.
My guess is that the method I need should go in here
Code:
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_item[i])
end
end
Thanks.