oh well i have nothing to lose
i made the
item window be called to appear in the
map scene instead of through the
menu scene (as well as the player's status) but the arrow keys don't move the cursor between items and pressing the action button only changes the item selection rectangle's opacity. so there are obviously issues with frame update, refresh, and that kind of thing but i can't figure out what to add to the Window_Item class:
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 64, 300, 260)
@column_max = 2
refresh
self.index = 0
@item_window = true
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 255
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
self.visible = false
return
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
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
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
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)
end
#--------------------------------------------------------------------------
# * Help Text Update and List Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
screenshot of the static thing:
(https://i.imgur.com/SJyxyEa.png)
also, i don't know how to close the window with another ESC press but that's not as high priority.
guidance is much appreciated.
I can tell that you're learning how to script. Good! But I will just tell you that what you're doing isn't super straightforward.
For starters, I'm going to need to see how you're calling your item window on the map. Did you modify Scene_Map to do this?
The check for button B is also doing nothing. Most likely you're going to want to put that in your map scene. Where it is right now, the only time it gets ran is when your game is opened and everything is loading before the title screen appears.
# an example...don't put this in your game
def update
if @item_window.active
@item_window.update
if Input.trigger?(Input::B)
@item_window.dispose
end
end
# other things that update in the scene go here...
end
Not sure what your plan is with the @item_window attribute either.