This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
Code:
#==============================================================================
# â–� Window_Item editted by Chrono Cry / Scaboon
#------------------------------------------------------------------------------
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# This window is all about the size e.g. the code super(0, 64, 640, 416) = (x, y, width, height)
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416) # The size as explained above
@column_max = 10 # This chooses how many columns there should be in this case 10 you can easily change it and you can change column to row
refresh # This refreshs the method in def_refresh
self.index = 0 # This is where the cursor starts
# This whole part below sorts out the item menu for the battle
if $game_temp.in_battle
self.y = 64 # Where about the item menu is positioned on screen
self.height = 256 # How high the window is so in this case 256 this is over a half remember the max height is 480 and width is 640
self.back_opacity = 160 # Changes the opacity of the window remember 0 is see through and 255 in solid
end
end # End of the def initalize
#--------------------------------------------------------------------------
#The part below tells the cpu to remember to go back to the item you used after using it
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# This method below refreshs everything so that if you get a new item it will display it and such n such
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# This is too sort out how many of that item you have
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# This is the same but for weapons
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
# And you guessed it this is for armour
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# This puts all that together so it works out properly
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface # This is the font your using if it says $fontface this refers to the Main script
# You can delete $fontface and replace it with "Arial" and it will show it in arial and you can use any other font just change the name
# Also if you get a script and it comes up with an error to do with $defaultfontface just change it to $fontface
self.contents.font.size = $fontsize # You guessed it this changes the size just put a number there like 16 etc instead of $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end # end of def_refresh
#--------------------------------------------------------------------------
# This is all about referring to the database about the item/weapon/armour
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item # This refers to the data base section on Item
number = $game_party.item_number(item.id) # This refers to the number of that item in the Item database
when RPG::Weapon # This refers to the data base section on Weapon
number = $game_party.weapon_number(item.id) # This refers to the number of that weapon in the Weapon database
when RPG::Armor # This refers to the data base section on Armor (why do americans speel it differently lol)
number = $game_party.armor_number(item.id) # This refers to the number of that armor in the Armor database
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id) # This just makes sure the party can actually use it
self.contents.font.color = normal_color # This makes the colour of text apear white if it can be used
else
self.contents.font.color = disabled_color # Thischanges the colour if it cant be used
end
x = 4 + index % 10 * (32 + 32) # This sorts out how the cursor moves along the X axis
y = index / 10 * 32 # Same applies but for the Y axis
rect = Rect.new(x, y, self.width / @column_max - 32, 32) # This is just the column default details
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) # This sorts out the fill colour of the cursor
bitmap = RPG::Cache.icon(item.icon_name) # This refers to the icon used for the Item etc
opacity = self.contents.font.color == normal_color ? 255 : 128 # This sorts out the colour once again but for the below
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) # This places the icon inside the window according to the co-ordinates etc
self.contents.draw_text(x + 2, y + 9, 24, 32, number.to_s, 2) # Same above but for how many you have of that item
end # end of another part
#--------------------------------------------------------------------------
# â—? ヘルプãƒ� ã‚スト更新
#--------------------------------------------------------------------------
def update_help # This sorts out what is displayed in the help box at the top
@help_window.set_text(self.item == nil ? "" : self.item.description) # This refers to the database to see what description the item has so it can be displayed in the help box
end
end # End of everything