Jump to content
Tsukihime

Custom Icon Sheets

Recommended Posts

This script allows you to designate which icon sheet you want to draw your icon from. This allows you to organize your icons so that you don't need to load one large iconset just to draw one icon.

 

Separate your icons into separate files, then load them by name and index!

You can even specify different icon sizes for different sheets.

 

Download

 

Get it at Hime Works

 

The icon index utility I use in the example below can be found here

 

Usage

 

Installation

 

Place this script below Materials and above Main.

 

Setting up icon sheets

 

Place any custom icon sheets in your Graphics/System folder.

In the configuration below, add the filenames (without extensions) to the

`Icon_Sheets` hash and the width and height of the icons for those sheets.

 

You must also include the default icon sheet to use,

which is "Iconset"

 

customIconSheets5.jpg

 

Using custom icon sheets

 

Now that you have set up your icon sheets, you can begin using them.

In your database, note-tag objects with

<icon: name index>
Where

`name` is the exact filename of the icon sheet, without extensions

`index` is the index of the icon in the specified file.

 

For example, suppose I have the following icon sheet called "CustomIcons"

 

customIconSheets2.jpg

 

After looking up the icon index, I want to assign it to my Potion item

 

customIconSheets3.jpg

 

Now when I load up the game, I will see that my potion is using the custom icon

 

customIconSheets4.jpg

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Thank you!  I was just about to ask how to do something like this because my icon set was getting too large and causing lag in my battle system.

<3 me some hime.

Share this post


Link to post
Share on other sites

Finally got to test it out.  So far it works like a charm!  Such an easier way to sort my items for different categories.  :)

 

-edit-

Actually, your script (or casper's script) doesn't work with the other. :(

http://www.rpgmakervxace.net/topic/2775-csca-encyclopedia-w-bestiary/

 

Since I'm not much of a scripter, not sure if it's something easy to fix or not, but I did find this part of the code in casper's script.

 

 

 

  def csca_draw_icon(item)
    if item.csca_custom_picture == ""
      icon_index = item.icon_index
      bitmap = Cache.system("Iconset")
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      target = Rect.new(0,0,72,72)
      contents.stretch_blt(target, bitmap, rect)
    else
      bitmap = Bitmap.new("Graphics/Pictures/"+item.csca_custom_picture+".png")
      target = Rect.new(0,0,72,72)
      contents.stretch_blt(target, bitmap, bitmap.rect, 255)
    end
  end

 

 

Edited by Tigerbite

Share this post


Link to post
Share on other sites

If anyone can find any (or write their own) icon index utilities I can add it to the post.

 

For that bestiary script just change it to this (untested)

  def csca_draw_icon(item)
    if item.csca_custom_picture == ""
      bitmap, icon_index = TH::Custom_Icon_Sheets.load_icon_sheet(item.icon_index)
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      target = Rect.new(0,0,72,72)
      contents.stretch_blt(target, bitmap, rect)
    else
      bitmap = Bitmap.new("Graphics/Pictures/"+item.csca_custom_picture+".png")
      target = Rect.new(0,0,72,72)
      contents.stretch_blt(target, bitmap, bitmap.rect, 255)
    end
  end
Edited by Tsukihime

Share this post


Link to post
Share on other sites

I also noticed using that any item that enlarges the icon (the encyclopedia/yanfly's equip/shop menus, etc.)  The enlarged icon shows up blank unless there is a note tag in the item "<icon: name index>" at which point the enlarged icon is from the default "Iconset."

 

Okay, semi fixed problems by listing Iconset first in my list of sheets on line 136.

 

    Icon_Sheets = ["Iconset", "WeaponIcons"]

 

However, doing this, the enlarged icons for anything on my "WeaponIcons" sheet show up blank.

Edited by Tigerbite

Share this post


Link to post
Share on other sites

Yanfly's is the same issue: they have their own icon drawing methods.

class Window_ShopData < Window_Base
  def draw_item_image
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(1, 1, 94, 94)
    contents.fill_rect(rect, colour)
    if @item.image.nil?
      bitmap, icon_index = TH::Custom_Icon_Sheets.load_icon_sheet(@item.icon_index)
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      target = Rect.new(0, 0, 96, 96)
      contents.stretch_blt(target, bitmap, rect)
    else
      bitmap = Cache.picture(@item.image)
      contents.blt(0, 0, bitmap, bitmap.rect, 255)
    end
  end
end
There is basically no way for me to avoid compatibility issues because the default script only passes the icon index to the draw_icon method.

 

The closest I can come to it is to change what it means to load the Iconset image, but then I don't know which image to load since that information is not given to me.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

That seems to be working fine.  I have 3 sheets, and put a shop up with 3 items (one from each sheet.)  Seems to work right.  Just gotta go plug that little code into all the other scripts. :P

 

 

-Edit-

Hmmm, that encyclopedia isn't editing as easy as Yanfly's script.  Keep getting undefined method for icon_index no matter what I do =x

Edited by Tigerbite

Share this post


Link to post
Share on other sites

Script updated to properly draw icons of the specified dimensions (eg: what you write for the Icon_Width and Icon_Height)

 

Doesn't mean it will look good on your window though since I don't change how the window looks.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

Hmmm This is just awesome but This doesn't seem to work very well with Mog Hunter's Advanced Battle Hud. The stats have no image even if I set it. If I don't use this... game freeze for a sec if I just change the icon set, but using this script fix it for some reason XD even though it end up having no icon image on states change... Not very good at writin script so... I would like some one to help me find a way to fix this problem ^^ 

Share this post


Link to post
Share on other sites

I'm using an iconset that goes up to 4000 at the moment, and I'm noticing some minor lag outside battle (not an issue), but a noticeable skip in battle whenever states are drawn (probably from refreshing the icons and searching through the 4000 set). So would using this script and making a smaller subset of about 100 icons just for states in battle alleviate it? Or would using this script actually cause more lag or make no difference?

 

I'll test it myself if no one else has, but I'd prefer to save some time if someone already has the answer.

Edited by Dark Horseman

Share this post


Link to post
Share on other sites

It does help it and the reason why I use and love this script.  I use the default iconset for anything battle related and keep it to as few icons as possible.  Then I have other sheets for anything else that I need (weapon/armors/signs/etc)

Share this post


Link to post
Share on other sites

I have updated the script to allow you to specify the width and height of each sheet individually.

So for example, one sheet might use 24x24 icons, while another sheet might use 32x32 icons, while another sheet might use 65x65 icons.

 

customiconsheets5.jpg

Edited by Tsukihime

Share this post


Link to post
Share on other sites

I can use another script or something?

You can use another script, but I don't have a script that will modify windows so that the text aligns the icons.

 

This script is meant to make it easier to load different icon sheets so that scripters don't have to think about how they will do it for their own scripts.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

The script allows you to use icons with larger sizes.

It doesn't change how your windows look.

 

That's the deal-breaker. There's barely a point in this script if you can't use custom-dimension icons. Which means we need to know how to make the text not overlap the icons.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted