RPGVX Ace 스크립트
2016.01.10 09:03

Custom Icon Sheets (커스텀 아이콘 적용 스크립트)

조회 수 470 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
원문출처 :
http://himeworks.com/2013/03/custom-icon-sheets/

직접 만든 아이콘을 사용할 수 있게 해주는 스크립트 입니다.
아래 파란색 처리된 부분에서 사용할 아이템을 지정합니다.
그리고 주석에 를 쓰면 사용가능하죠.



#===============================================================================
Title: Custom Icon Sheets
Author: Hime
Date: Jun 1, 2016
--------------------------------------------------------------------------------
** Change log
Jun 1, 2015
- added patch for yanfly's ace item menu
May 27, 2015
- fixed bug with yanfly's shop options
Jun 13, 2013
- icon width and height is now specified for each sheet individually
Mar 31, 2013
- now correctly draws icons of non-default sizes
Mar 25, 2013
- Initial release
--------------------------------------------------------------------------------
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description

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.
--------------------------------------------------------------------------------
** Installation

Place this script below Materials and above Main

--------------------------------------------------------------------------------
** Usage

-- Installation --

Place this script below Materials and above Main.

-- Setting up custom 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` array. You must also include the default icon sheet to use,
which is "Iconset"

-- Using custom icon indices --

Now that you have set up your icon sheets, you can begin using them.
In your database, note-tag objects with



Where
`name` is the exact filename of the icon index, without extensions
`index` is the index of the icon in the specified file.

--------------------------------------------------------------------------------
** Compatibility

This script overwrites the following methods:

Window_Base
draw_icon

#===============================================================================
=end
$imported = {} if $imported.nil?
$imported["TH_CustomIconSheets"] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
module Custom_Icon_Sheets

# List of icon sheets to load. Case-insensitive.
# All icon sheets must be placed in the System folder
# You must provide the dimensions of the icons as well


Icon_Sheets = {
"Iconset" => [24, 24],
"Weapons_1" => [24, 24],
#"CustomIcons" => [24, 24],
#"LargeIcons" => [65, 65]
}


# The default sheet to use if none is specified
Default_Sheet = "Iconset"

# Note-tag format.
Regex = //i

#===============================================================================
# ** Rest of script
#===============================================================================

#---------------------------------------------------------------------------
# Each sheet starts at a specific icon index.
#---------------------------------------------------------------------------
def self.icon_offsets
@icon_offsets
end
#---------------------------------------------------------------------------
# Load all icon sheets. This script uses a look-up table to map icon
# indices to specific icon sheets.
#---------------------------------------------------------------------------
def self.load_sheets
@icon_offsets = {}
@icon_table = []
icon_count = 0
Icon_Sheets.each {|sheet, (width, height)|
sheet = sheet.downcase
bmp = Cache.system(sheet)

# update the "icon index offset" for the current icon sheet.
# This is used by the look-up table to determine how the icon index
# is offset
@icon_offsets[sheet] = icon_count
@icon_table.push([sheet, icon_count, width, height])

# number of icons per sheet is given by the number of icons per row
# times the number of icons per height, including empty spaces.
icon_count += (bmp.width / width) * (bmp.height / height)
}

# store the icon table in reverse order
@icon_table.reverse!
end

def self.load_icon_sheet(index)
@icon_table.each {|sheet, offset, width, height|
if index >= offset
index -= offset
return Cache.system(sheet), index, width, height
end
}
end
end
end

module RPG
class BaseItem
def icon_sheet
return @icon_sheet unless @icon_sheet.nil?
load_notetag_custom_icon_sheet
return @icon_sheet
end

def load_notetag_custom_icon_sheet
res = self.note.match(TH::Custom_Icon_Sheets::Regex)
if res
@icon_sheet = res[1].downcase
@custom_icon_index = res[2].to_i
else
@icon_sheet = TH::Custom_Icon_Sheets::Default_Sheet.downcase
@custom_icon_index = @icon_index
end
end

alias :th_custom_icon_sheets_icon_index :icon_index
def icon_index
parse_custom_icon_index unless @custom_icon_index_checked
th_custom_icon_sheets_icon_index
end

#---------------------------------------------------------------------------
# Automatically updates the icon index based on the appropriate icon sheet
# to use.
#---------------------------------------------------------------------------
def parse_custom_icon_index
# offset the index as necessary, using the icon sheet to look up the offset
self.icon_index = TH::Custom_Icon_Sheets.icon_offsets[self.icon_sheet] + @custom_icon_index
@custom_icon_index_checked = true
end
end
end

module DataManager

class << self
alias :th_custom_icon_sheets_load_database :load_database
end

#-----------------------------------------------------------------------------
# Prepare the custom icon database
#-----------------------------------------------------------------------------
def self.load_database
th_custom_icon_sheets_load_database
TH::Custom_Icon_Sheets.load_sheets
end
end

class Window_Base < Window

#-----------------------------------------------------------------------------
# Overwrite. Get the appropriate bitmap to draw from.
#-----------------------------------------------------------------------------
def draw_icon(icon_index, x, y, enabled = true)
bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
end
end

#===============================================================================
# Compatibility patches. This script must be placed under the other scripts
#===============================================================================
class CSCA_Window_EncyclopediaInfo < Window_Base
def csca_draw_icon(item)
if item.csca_custom_picture == ""
bitmap, icon_index, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
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
end if $imported["CSCA-Encyclopedia"]

#===============================================================================
# Compatibility with Yanfly Ace Shop Options: drawing custom icon in shop
#===============================================================================
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, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(@item.icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
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 if $imported["YEA-ShopOptions"]

#===============================================================================
# Compatibility with Yanfly Ace Item Menu: drawing custom icon in item menu
#===============================================================================
class Window_ItemStatus < 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, icon_width, icon_height = TH::Custom_Icon_Sheets.load_icon_sheet(@item.icon_index)
rect = Rect.new(icon_index % 16 * icon_width, icon_index / 16 * icon_height, icon_width, icon_height)
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 if $imported["YEA-ItemMenu"]

?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수 추천 수
22 RPGVX Ace 스크립트 1인용메뉴 file A.M.S 2010.07.18 2609 0
21 RPGVX Ace 스크립트 파티원 기차처럼 줄줄이 붙는 스크립트. 1 file 천무 2015.11.12 3088 0
20 RPGVX Ace 스크립트 Damage Popup by Dargor (데미지 수치 팝업하는 스크립트) plam 2016.01.10 612 0
» RPGVX Ace 스크립트 Custom Icon Sheets (커스텀 아이콘 적용 스크립트) plam 2016.01.10 470 0
18 RPGVX Ace 스크립트 파일 존재의 유무 체크 4 휴리드 2013.09.30 639 0
17 RPGVX Ace 스크립트 텍스트 파일생성 1 휴리드 2013.09.30 654 0
16 RPGVX Ace 스크립트 Rpg Vx Ace 에서 이벤트 이름 팝업 3 빙냥이 2014.01.17 1895 0
15 RPGVX Ace 스크립트 RPG Maker VX Ace용 로고 스크립트 3 HUR 2014.08.04 1180 0
14 RPGVX Ace 스크립트 RPG Maker VX Ace용 640*480 리사이징 스크립트 3 HUR 2014.08.04 1268 0
13 RPGVX Ace 스크립트 VX Ace 스크립트 사이트 1 제피 2014.08.07 2672 0
12 RPGVX Ace 스크립트 Ace로 만든 습작 랜덤 위치로 지형변환. JunkMan 2014.10.04 512 0
11 RPGVX Ace 스크립트 RPG Maker VX Lite Maze(미로) 만들기 (DFS 사용) 1 JunkMan 2014.10.06 967 2
10 RPGVX Ace 스크립트 Random Dungeon Generator - Random Cave JunkMan 2014.10.08 607 0
9 RPGVX Ace 스크립트 Random Dungeon Generator - Random Room 7 JunkMan 2014.10.11 928 0
8 RPGVX Ace 스크립트 추천 스크립트 모음 2 철창노틸 2015.03.26 5851 1
7 RPGVX Ace 스크립트 Mog Hunter 스페셜 철창노틸 2015.03.26 762 1
6 RPGVX Ace 스크립트 타이틀 메뉴 위치 바꾸기 vx 및 vx ace 여줄가리 2015.09.21 2001 0
5 RPGVX Ace 스크립트 지속데미지 스크립트(MBS) 天下太平 2016.02.14 1516 0
4 RPGVX Ace 스크립트 VX Ace 용 8방향 이동 스크립트 1 도라지power 2016.03.17 1654 0
3 RPGVX Ace 스크립트 [VXAce] 레이어 맵 <layer> 시스템 file LuD 2017.08.07 1042 0
Board Pagination Prev 1 2 Next
/ 2






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)