[VX] Extra Iconsets

Extra Iconset
Version: 1.0
By: Dargor


Introduction

I did this little script last year and wasn't sure if I should post it or not.
It's been ages since I have released a script so I decided to release all my unreleased scripts, starting by this one!

This script let you have as many iconsets as you want, simple as that.

Features

  • Can have specific iconsets for items, weapons, armors and states

Script

script Spoiler
  1. #==============================================================================
  2. # ** Extra Iconset
  3. #------------------------------------------------------------------------------
  4. #  © Dargor, 2009
  5. #  15/12/09
  6. #  Version 1.0
  7. #------------------------------------------------------------------------------
  8. #  VERSION HISTORY:
  9. #   - 1.0 (15/12/09), Initial release
  10. #------------------------------------------------------------------------------
  11. #  INSTRUCTIONS:
  12. #   - Paste this above main
  13. #   - Edit the constants in the Extra_Iconset module
  14. #==============================================================================
  15.  
  16. module Extra_Iconset
  17.   # SYNTAX: { ID => 'IconSet_Name' }
  18.   Items = {1=>'IconSet'}
  19.   Weapons = {}
  20.   Armors = {}
  21.   States = {}
  22.   # Default Iconset Name
  23.   Default = 'IconSet'
  24. end
  25.  
  26. #==============================================================================
  27. # ** RPG::BaseItem
  28. #==============================================================================
  29.  
  30. class RPG::BaseItem
  31.   #--------------------------------------------------------------------------
  32.   # * Iconset
  33.   #--------------------------------------------------------------------------
  34.   def iconset
  35.     case self
  36.     when RPG::UsableItem
  37.       set = Extra_Iconset::Items[@id]
  38.     when RPG::Weapon
  39.       set = Extra_Iconset::Weapons[@id]
  40.     when RPG::Armor
  41.       set = Extra_Iconset::Armors[@id]
  42.     end
  43.     if set.nil?
  44.       return Extra_Iconset::Default
  45.     else
  46.       return set
  47.     end
  48.   end
  49. end
  50.  
  51. #==============================================================================
  52. # ** RPG::State
  53. #==============================================================================
  54.  
  55. class RPG::State
  56.   #--------------------------------------------------------------------------
  57.   # * Get Normal Attack Animation ID
  58.   #--------------------------------------------------------------------------
  59.   def iconset
  60.     if Extra_Iconset::States[@id].nil?
  61.       return Extra_Iconset::Default
  62.     else
  63.       return Extra_Iconset::States[@id]
  64.     end
  65.   end
  66. end
  67.  
  68. #==============================================================================
  69. # ** Window_Base
  70. #------------------------------------------------------------------------------
  71. #  This is a superclass of all windows in the game.
  72. #==============================================================================
  73.  
  74. class Window_Base < Window
  75.   #--------------------------------------------------------------------------
  76.   # * Draw Icon
  77.   #     icon_index : Icon number
  78.   #     x     : draw spot x-coordinate
  79.   #     y     : draw spot y-coordinate
  80.   #     enabled    : Enabled flag. When false, draw semi-transparently.
  81.   #--------------------------------------------------------------------------
  82.   def draw_icon(icon_index, x, y, enabled = true, iconset = 'Iconset')
  83.     bitmap = Cache.system(iconset)
  84.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  85.     self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # * Draw Item Name
  89.   #     item    : Item (skill, weapon, armor are also possible)
  90.   #     x       : draw spot x-coordinate
  91.   #     y       : draw spot y-coordinate
  92.   #     enabled : Enabled flag. When false, draw semi-transparently.
  93.   #--------------------------------------------------------------------------
  94.   def draw_item_name(item, x, y, enabled = true)
  95.     if item != nil
  96.       draw_icon(item.icon_index, x, y, enabled, item.iconset)
  97.       self.contents.font.color = normal_color
  98.       self.contents.font.color.alpha = enabled ? 255 : 128
  99.       self.contents.draw_text(x + 24, y, 172, WLH, item.name)
  100.     end
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # * Draw State
  104.   #     actor : actor
  105.   #     x     : draw spot x-coordinate
  106.   #     y     : draw spot y-coordinate
  107.   #     width : draw spot width
  108.   #--------------------------------------------------------------------------
  109.   def draw_actor_state(actor, x, y, width = 96)
  110.     count = 0
  111.     for state in actor.states
  112.       draw_icon(state.icon_index, x + 24 * count, y, state.iconset)
  113.       count += 1
  114.       break if (24 * count > width - 24)
  115.     end
  116.   end
  117. end
  118.  
Expand to see the code.


Instructions

Place this script above Main and edit the constants in the Extra_Iconset module.

Compatibility

Should be compatible with everything, except scripts that overwrite the draw_icon, draw_item_name and draw_actor_state methods.

Terms and Conditions

Don't forget to give me credits!

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=71011