Character Icon
Script original por Hideo, conversão por Takkun.
Esse script possibilita o uso de ícones como characters de um modo fácil e útil.Script original por Hideo, conversão por Takkun.
Ruby:
#====================================(¯¯¯¯)====================================#
# Character Icon #
#====================================(____)====================================#
#Por: Hideo •
#Convertido: Faalco •
#19/02/10 •
#1.0 •
#••••••••••
#(¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯)
#( Como Usar )
#( Para fazer um ícone aparecer no evento, use um comentário )
#( com isso: icon=index )
#( Index é o índice do icone no iconset. Para usar o de um item)
#( ao invés de colocar o index, coloque: )
#( item id_do_item )
#( weapon id_da_arma )
#( armor id_da_armadura )
#( skill id_da_habilidade )
#( exemplo: icon=weapon 1 - irá aparecer o icone da arma 1 )
#'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯'
class Game_Event
alias icon_char_setup_page setup_page
def setup_page(new_page)
icon_char_setup_page(new_page)
@icon = 0
if @list != nil
for item in @list
if item.code == 108 and item.parameters[0].include?("icon=")
@icon = eval item.parameters[0].split('=')[1]
end
end
end
end
end
class Game_Character
attr_accessor :icon
alias icon_initialize initialize
def initialize
icon_initialize
@icon = 0
end
def item(id)
return $data_items[id].icon_index
end
def weapon(id)
return $data_weapons[id].icon_index
end
def armor(id)
return $data_armors[id].icon_index
end
def skill(id)
return $data_skills[id].icon_index
end
end
class Sprite_Character
def draw_icon(icon_index, x, y)
ic = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.bitmap.blt(x, y, ic, rect,255)
end
alias icon_update update
def update
icon_update
if @character.icon != 0 and @character.icon != nil
if @character.character_name == "" and @character.tile_id == 0
self.bitmap = Bitmap.new(32,32)
self.src_rect = Rect.new(0,0,32,32)
self.ox = 16
self.oy = 32
end
if @character.tile_id != 0 and self.bitmap.width != 32
bmp = Bitmap.new(32,32)
for x in self.src_rect.x..self.src_rect.x+32
for y in self.src_rect.y..self.src_rect.y+32
bmp.set_pixel(x-src_rect.x,y-src_rect.y,self.bitmap.get_pixel(x,y))
end
end
self.bitmap = bmp
self.src_rect = Rect.new(0,0,32,32)
end
draw_icon(@character.icon,self.src_rect.x+4,self.src_rect.y+4)
end
end
end