Skip to content

Instantly share code, notes, and snippets.

@kl
Last active December 18, 2015 13:09
Show Gist options
  • Select an option

  • Save kl/5787548 to your computer and use it in GitHub Desktop.

Select an option

Save kl/5787548 to your computer and use it in GitHub Desktop.
RPG Maker VX Ace show equip item pictures instead of stats
#
# KalEquipPictures 1.0 by Kal
# ---------------------------
# Changes the equip status window to display an item picture.
# Usage: First import you pictures to the Graphics/Pictures folder.
# Then in the item note box but a tag like this: <TAG_NAME filename>
# Example: <image sword01.png>
#
module KalEquipPictures
# change this if you want to use a different tag name
TAG_NAME = "image"
end
class Window_EquipSlot
alias_method :update_cursor_ep_kal, :update_cursor
def update_cursor
update_cursor_ep_kal
@observers_ep_kal.each { |o| o.on_update_cursor_ep_kal(self) } if @observers_ep_kal
end
def register_observer_ep_kal(observer)
@observers_ep_kal ||= []
@observers_ep_kal << observer
end
end
class Window_EquipStatus
def on_update_cursor_ep_kal(slot_window)
item = slot_window.item
if item
@image_file_name_ep_kal = item.note[/<#{KalEquipPictures::TAG_NAME}\s+(.+?)>/, 1]
else
@image_file_name_ep_kal = nil
end
refresh
end
def refresh
contents.clear
if @image_file_name_ep_kal
bitmap = Bitmap.new("Graphics/Pictures/#{@image_file_name_ep_kal}")
centered_x = (contents.width - bitmap.width) / 2
centered_y = (contents.height - bitmap.height) / 2
contents.blt(centered_x, centered_y, bitmap, bitmap.rect)
bitmap.dispose
end
end
end
class Scene_Equip
alias_method :start_ep_kal, :start
def start
start_ep_kal
@slot_window.register_observer_ep_kal(@status_window)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment