Apellonyx

Collectibles! v1.0

Apr 8th, 2013
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.60 KB | None | 0 0
  1. =begin
  2. ======================================
  3.   Collectibles!
  4.   Created by: Apellonyx
  5.   Released: 8 April 2013
  6. ======================================
  7.   Terms of Use:
  8.     You are free to use this system however you wish, in commercial and non-
  9.     commercial games alike. If you edit the script extensively, it is not
  10.     necessary to credit me (since you clearly only used my code as a framework),
  11.     but I would appreciate credit if it is used in its current form, or if only
  12.     minor changes were made to the script.
  13. ======================================
  14.   Support:
  15.     While I am not wildly active, I usually log onto "rpgmakervxace.com" daily,
  16.     so if you have any questions pertaining to the script, you can ask any
  17.     questions there, in the topic in which this script was released. Just as a
  18.     warning, though, I will not edit the script to make it compatible with any
  19.     special menu systems, but I will try to fix bugs as they come up. If you
  20.     find one, let me know, and I'll do my best to squash the thing.
  21. ======================================
  22.   Changelog:
  23.     v1.0: Initial release
  24. ======================================
  25.   Requirements:
  26.     None
  27. ======================================
  28.   Description:
  29.     This script adds a new window to the main menu that shows how many of a
  30.     particular item the player has. It is meant to be used with collectible
  31.     items and/or key items, and supports tracking for an unlimited amount of
  32.     items (though it overlaps the command window when more than six items are
  33.     being tracked).
  34. ======================================
  35.   Instructions:
  36.     Just add the database IDs for your collectibles into the ITEMIDS array. If
  37.     using the default menu, the window will fit perfectly above the gold window.
  38.     If using a custom menu script, you may need to adjust the WINXPOS, WINYPOS,
  39.     and WINWIDTH to fit your menu.
  40. ======================================
  41. =end
  42.  
  43.  
  44. module AXCollect
  45.  
  46.   WINXPOS     = 0 # X position of the collectibles window
  47.   WINYPOS     = 344 # Y position of the collectibles window
  48.   WINWIDTH    = 160 # Width of the collectibles window
  49.   WINTEXT     = 24 # Size of the text in the window (adjust if your item has
  50.                    # a longer name than fits in the window)
  51.   ITEMIDS     = [17, 18] # Database IDs for collectible items
  52.  
  53. end
  54.  
  55. class Scene_Menu < Scene_MenuBase
  56.  
  57.   alias collect_menu_start start
  58.   def start
  59.     create_collectibles_window
  60.     collect_menu_start
  61.   end
  62.   def create_collectibles_window
  63.     collectwinheight = AXCollect::ITEMIDS.size * 24
  64.     collectwinypos = AXCollect::WINYPOS - collectwinheight
  65.     @collect_menu = Window_Collectibles.new
  66.     @collect_menu.x = AXCollect::WINXPOS
  67.     @collect_menu.y = collectwinypos
  68.     @collect_menu.z = 10000
  69.   end
  70.  
  71. end
  72.  
  73. class Window_Collectibles < Window_Base
  74.  
  75.   def initialize
  76.     collectwinheight2 = AXCollect::ITEMIDS.size * 24 + 24
  77.     super(0, 0, AXCollect::WINWIDTH, collectwinheight2)
  78.     refresh
  79.   end
  80.   def refresh
  81.     contents.clear
  82.     contents.font.size = AXCollect::WINTEXT
  83.     itemids = AXCollect::ITEMIDS
  84.     itemids.each_with_index do |itemid, index|
  85.       draw_collectibles($data_items[itemid], -3, index * 24)
  86.     end
  87.   end
  88.   def draw_collectibles(item, x, y, width = AXCollect::WINWIDTH - 22)
  89.     draw_icon(item.icon_index, x, y - 1)
  90.     change_color(system_color)
  91.     draw_text(x + 24, y, width, line_height, item.name + "s")
  92.     change_color(normal_color)
  93.     draw_text(x, y, width, line_height, $game_party.item_number(item), 2)
  94.   end
  95.   def draw_item_name(item, x, y, enabled = true, width = 100)
  96.   end
  97.  
  98. end
Advertisement
Add Comment
Please, Sign In to add comment