Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[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

Code:
#==============================================================================

# ** Extra Iconset

#------------------------------------------------------------------------------

#  © Dargor, 2009

#  15/12/09

#  Version 1.0

#------------------------------------------------------------------------------

#  VERSION HISTORY:

#   - 1.0 (15/12/09), Initial release

#------------------------------------------------------------------------------

#  INSTRUCTIONS:

#   - Paste this above main

#   - Edit the constants in the Extra_Iconset module

#==============================================================================

 

module Extra_Iconset

  # SYNTAX: { ID => 'IconSet_Name' }

  Items = {1=>'IconSet'}

  Weapons = {}

  Armors = {}

  States = {}

  # Default Iconset Name

  Default = 'IconSet'

end

 

#==============================================================================

# ** RPG::BaseItem

#==============================================================================

 

class RPG::BaseItem

  #--------------------------------------------------------------------------

  # * Iconset

  #--------------------------------------------------------------------------

  def iconset

    case self

    when RPG::UsableItem

      set = Extra_Iconset::Items[@id]

    when RPG::Weapon

      set = Extra_Iconset::Weapons[@id]

    when RPG::Armor

      set = Extra_Iconset::Armors[@id]

    end

    if set.nil?

      return Extra_Iconset::Default

    else

      return set

    end

  end

end

 

#==============================================================================

# ** RPG::State

#==============================================================================

 

class RPG::State

  #--------------------------------------------------------------------------

  # * Get Normal Attack Animation ID

  #--------------------------------------------------------------------------

  def iconset

    if Extra_Iconset::States[@id].nil?

      return Extra_Iconset::Default

    else

      return Extra_Iconset::States[@id]

    end

  end

end

 

#==============================================================================

# ** Window_Base

#------------------------------------------------------------------------------

#  This is a superclass of all windows in the game.

#==============================================================================

 

class Window_Base < Window

  #--------------------------------------------------------------------------

  # * Draw Icon

  #     icon_index : Icon number

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     enabled    : Enabled flag. When false, draw semi-transparently.

  #--------------------------------------------------------------------------

  def draw_icon(icon_index, x, y, enabled = true, iconset = 'Iconset')

    bitmap = Cache.system(iconset)

    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)

    self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)

  end

  #--------------------------------------------------------------------------

  # * Draw Item Name

  #     item    : Item (skill, weapon, armor are also possible)

  #     x       : draw spot x-coordinate

  #     y       : draw spot y-coordinate

  #     enabled : Enabled flag. When false, draw semi-transparently.

  #--------------------------------------------------------------------------

  def draw_item_name(item, x, y, enabled = true)

    if item != nil

      draw_icon(item.icon_index, x, y, enabled, item.iconset)

      self.contents.font.color = normal_color

      self.contents.font.color.alpha = enabled ? 255 : 128

      self.contents.draw_text(x + 24, y, 172, WLH, item.name)

    end

  end

  #--------------------------------------------------------------------------

  # * Draw State

  #     actor : actor

  #     x     : draw spot x-coordinate

  #     y     : draw spot y-coordinate

  #     width : draw spot width

  #--------------------------------------------------------------------------

  def draw_actor_state(actor, x, y, width = 96)

    count = 0

    for state in actor.states

      draw_icon(state.icon_index, x + 24 * count, y, state.iconset)

      count += 1

      break if (24 * count > width - 24)

    end

  end

end

 

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!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top