Introdução
Boa noite galerinha, trago aqui para vocês um sistema que não era pra ser tão abrangente, mas devido as dicas e pedidos de um amigo ele ficou bem completo.
Como usa?
Na pasta Graphics\Characters vocês devem criar algumas pastas, são elas:
Armor, Helmet, Shield e Weapon
Explicando as pastas: Cada uma terá os gráficos do VE desse tipo de equipamento, se for arma ficará na Weapon, se for excudo na Shield, armadura na Armor, elmo na Helmet. O nome da imagem terá que ser o sexo e o id do item, por exemplo: Se o item tiver id 22 e o gráfico for masculino a imagem será: H22. Se for feminino será M22. Se o id na database for 10, será H10 ou M10.
Exemplo:
Print Screen
Script
Créditos
Paulo Soreto - Criador
Boa noite galerinha, trago aqui para vocês um sistema que não era pra ser tão abrangente, mas devido as dicas e pedidos de um amigo ele ficou bem completo.
Como usa?
Na pasta Graphics\Characters vocês devem criar algumas pastas, são elas:
Armor, Helmet, Shield e Weapon
Explicando as pastas: Cada uma terá os gráficos do VE desse tipo de equipamento, se for arma ficará na Weapon, se for excudo na Shield, armadura na Armor, elmo na Helmet. O nome da imagem terá que ser o sexo e o id do item, por exemplo: Se o item tiver id 22 e o gráfico for masculino a imagem será: H22. Se for feminino será M22. Se o id na database for 10, será H10 ou M10.
Exemplo:
- Spoiler:
Print Screen
- Spoiler:
Script
- Código:
#==============================================================================
# Visual Equipment
#------------------------------------------------------------------------------
# Paulo Soreto
# v1.2
#==============================================================================
#==============================================================================
# Sprite_Character
#------------------------------------------------------------------------------
# Esta é o script que exibe os sprites dos Heróis. Levando em consideração
# a classe Game_Character fazendo correções quando necessário.
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# Variáveis Públicas
#--------------------------------------------------------------------------
attr_accessor :character # Herói
#--------------------------------------------------------------------------
# Inicialização dos Objetos
#
# viewport : ponto de vista
# character : Herói
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@character = character
update
end
#--------------------------------------------------------------------------
# Atualização do Frame
#--------------------------------------------------------------------------
def update
super
# Caso o ID de Tile, o nome do arquivo, ou a cor são diferentes da atual
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
# Lembrar ao ID de Tile, o nome do arquivo e a cor
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# Caso o valor do ID de Tile seja válida
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# Caso o valor do ID de Tile seja inválido
else
bmp = RPG::Cache.character(@character.character_name, @character.character_hue)
self.bitmap = Bitmap.new(bmp.width, bmp.height)
self.bitmap.blt(0, 0, bmp, Rect.new(0, 0, bmp.width, bmp.height))
$sexo.downcase == 'homem' ? px = 'H' : px = 'M'
ve = [RPG::Cache.character(@character.character_name, @character.character_hue),
RPG::Cache.character('Armor/' + px + $game_party.actors[0].armor3_id.to_s, @character.character_hue),
RPG::Cache.character('Helmet/' + px + $game_party.actors[0].armor2_id.to_s, @character.character_hue),
RPG::Cache.character('Shield/' + px + $game_party.actors[0].armor1_id.to_s, @character.character_hue),
RPG::Cache.character('Weapon/' + px + $game_party.actors[0].weapon_id.to_s, @character.character_hue),
RPG::Cache.character('Helmet/' + px + $game_party.actors[0].armor2_id.to_s, @character.character_hue)]
#=========================================================
if @character.is_a?(Game_Player)
for i in 0...ve.size
self.bitmap.blt(0, 0, ve[i], Rect.new(0, 0, bmp.width, bmp.height))
end
end
#=========================================================
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
# Definir a situação como visível
self.visible = (not @character.transparent)
# Se o gráfico for de um Herói
if @tile_id == 0
# Definir uma transferência regular
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
# Definir as coordenadas do Sprite
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# Definir o nível de opacidade, a sinteticidade e a profundidade do Gramado
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Então é feita a animação
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
update_display_text
end
#--------------------------------------------------------------------------
# * Create Display Sprite
#--------------------------------------------------------------------------
def create_display_sprite(args)
# Creates Display Bitmap
bitmap = Bitmap.new(160, 24)
bitmap.font.size = 15
# Draws Text Shadow
bitmap.font.draw_shadow = false if bitmap.font.respond_to?(:draw_shadow)
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(1, 1, 160, 24, args[0], 1)
bitmap.font.color = args[1]
# Draws Text
bitmap.draw_text(0, 0, 160, 24, args[0], 1)
# Creates Display Text Sprite
@_text_display = Sprite.new(self.viewport)
@_text_display.bitmap = bitmap
#@_text_display.opacity = 180
@_text_display.ox = 80
@_text_display.oy = 20
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
@_text_display.z = 30001
@_text_display.visible = self.visible #true
end
#--------------------------------------------------------------------------
# * Create Display Guild
#--------------------------------------------------------------------------
def create_display_guild(args)
# Creates Display Bitmap
bitmap = Bitmap.new(160, 24)
bitmap.font.name = "Comic Sans MS"
bitmap.font.size = 15
actor = $game_party.actors[0]
# Draws Text Shadow
if bitmap.font.respond_to?(:draw_shadow)
bitmap.font.draw_shadow = false
end
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(6, 1, 160, 24, actor.guild, 1)
bitmap.font.color = args[0]
# Draws Text
icon = RPG::Cache.icon("Mini-Flag#{$flag}")
bitmap.blt(55-actor.guild.size,8,icon,icon.rect)
bitmap.draw_text(5, 0, 160, 24, actor.guild, 1)
$old_guild = args[0]
# Creates Display Text Sprite
@_g_display = Sprite.new(self.viewport)
@_g_display.bitmap = bitmap
#@_g_display.opacity = 180
@_g_display.ox = 80
@_g_display.oy = 22
@_g_display.x = self.x
@_g_display.y = self.y - self.oy / 2 - 24
@_g_display.z = 30001
@_g_display.visible = self.visible #true
end
#--------------------------------------------------------------------------
# * Dispose Display Sprite
#--------------------------------------------------------------------------
def dispose_display_text
@_text_display.dispose unless @_text_display.nil?
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
unless @character.text_display.nil?
create_display_sprite(@character.text_display) if @_text_display.nil?
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
else
dispose_display_text unless @_text_display.nil?
end
unless !@character.is_a?(Game_Player)
if $guild_name != ""
if @_g_display.nil? and User_Edit::GUILD_NAME == true
create_display_guild([User_Edit::GUILD_COLOR])
end
if User_Edit::GUILD_NAME == true
@_g_display.x = self.x
@_g_display.y = self.y - self.oy / 2 - 35
end
end
end
end
end
#==============================================================================
# ** Sprite_Character - This sprite is used to display the character. It
# observes the Game_Character class and automatically
# changes sprite conditions.
#------------------------------------------------------------------------------
# Author Me™ and Mr.Mo
# Modified Valentine
# Idea Destined
#==============================================================================
class Sprite_NetCharacter < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character
attr_accessor :netid
#--------------------------------------------------------------------------
# * Object Initialization
# viewport : viewport
# character : character (Game_Character)
#--------------------------------------------------------------------------
def initialize(viewport, id, character = nil)
super(viewport)
@character = character
@netid = id
# Creates Display Bitmap
bitmap = Bitmap.new(500, 500)
bitmap2 = Bitmap.new(640, 480)
# Draws Text Shadow
bitmap.font.size = 15
bitmap.font.draw_shadow = false if bitmap.font.respond_to?(:draw_shadow)
bitmap.font.color = Color.new(0, 0, 0)
bitmap.font.name = "Comic Sans MS"
if User_Edit::GUILD_NAME == true
if @character.guild != ""
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(6, 1, 160, 24, @character.guild, 1)
# Changes Font Color
bitmap.font.color = User_Edit::GUILD_COLOR
# Draws Text
icon = RPG::Cache.icon("Mini-Flag#{@character.flag}")
bitmap.blt(55-@character.guild.size,8,icon,icon.rect)
bitmap.draw_text(5, 0, 160, 24, @character.guild, 1)
end
end
bitmap.font.size = 15
# Draws Text Shadow
bitmap.font.color = Color.new(0, 0, 0)
bitmap.font.name = Font.default_name
bitmap.draw_text(1, 14, 160, 24, @character.nome, 1)
# Draws Text
if @character.grupo == "Admin" and User_Edit::COLOR_ADMIN == true
bitmap.font.color = User_Edit::ADM_COLOR
else
bitmap.font.color = User_Edit::PLAYER_COLOR
end
bitmap.draw_text(0, 13, 160, 24, @character.nome, 1)
if User_Edit::HP_MP == true
#Base
hud3 = RPG::Cache.picture("Actor Base.PNG")
hud1 = hud3.width
hud2 = hud3.height
hud4 = Rect.new(0,0,hud1,hud2)
bitmap.blt(66,82,hud3,hud4)
#HP
hpbar = RPG::Cache.picture("Actor HP")
hpbarwidth = hpbar.width * @character.hp / @character.maxhp
hpbarheight = hpbar.height
hpbar_rect = Rect.new(0,0,hpbarwidth,hpbarheight)
bitmap.blt(66,82,hpbar,hpbar_rect)
end
# Creates Display Text Sprite
@_text_display = Sprite.new(self.viewport)
@_text_display.bitmap = bitmap
@_text_display.ox = 80
@_text_display.oy = 33
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
@_text_display.z = 30000
@_text_display.visible = self.visible #true
if @character.chat_text != ""
msg1 = @character.chat_text
msg2 = ""
b = Bitmap.new(1,1)
w1 = b.text_size(msg1).width
bitmap2 = Bitmap.new([w1].max+8, (msg2 == "" ? 22 : 48))
bitmap2.font.name = Font.default_name
bitmap2.font.size = 15
bitmap2.fill_rect(1, 1, bitmap2.width-2, 14, Color.new(255,255,255))
bitmap2.fill_rect(1, 0, bitmap2.width-2, 1, Color.new(255,255,255))
bitmap2.fill_rect(1, bitmap2.height-10, 21, 1, Color.new(255,255,255))
bitmap2.fill_rect(0, 1, 1, 13, Color.new(255,255,255))
bitmap2.fill_rect(bitmap2.width-1, 1, 1, 13, Color.new(255,255,255))
center = (bitmap2.width-8)/2
bitmap2.fill_rect(center, 15, 1, 8, Color.new(255,255,255))
bitmap2.fill_rect(center+1, 15, 1, 7, Color.new(255,255,255))
bitmap2.fill_rect(center+2, 15, 1, 6, Color.new(255,255,255))
bitmap2.fill_rect(center+3, 15, 1, 5, Color.new(255,255,255))
bitmap2.fill_rect(center+4, 15, 1, 4, Color.new(255,255,255))
bitmap2.fill_rect(center+5, 15, 1, 3, Color.new(255,255,255))
bitmap2.fill_rect(center+6, 15, 1, 2, Color.new(255,255,255))
bitmap2.fill_rect(center+7, 15, 1, 1, Color.new(255,255,255))
bitmap2.draw_text(2, 0, bitmap2.width-4, 16, msg1, 1)
end
@chat_text_display = Sprite.new(self.viewport)
@chat_text_display.bitmap = bitmap2
@chat_text_display.ox = bitmap2.width/2#80
@chat_text_display.oy = -45
@chat_text_display.opacity = 255
@chat_text_display.x = self.x
@chat_text_display.y = self.y - self.oy / 2 - 24
@chat_text_display.z = 30000
@chat_text_display.visible = self.visible #true
self.opacity = 0
update
end
#--------------------------------------------------------------------------
# * Disposes Text
#--------------------------------------------------------------------------
def dispose
@_text_display.dispose
@chat_text_display.dispose
super
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If tile ID, file name, or hue are different from current ones
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
#Updates tile info
update_tile
end
# Set visible situation
self.visible = (not @character.transparent)
# If graphic is character
animate_player if @tile_id == 0
# Set sprite coordinates
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
# Set opacity level, blend method, and bush depth
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
# Animation
update_ani if @character.animation_id != 0
if @character.damage_show != nil
damage(@character.damage_show, @character.show_critical)
@character.show_demage(nil, false)
end
# Name Sprite
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
@chat_text_display.x = self.x
@chat_text_display.y = self.y - 129#- self.oy / 2 - 24
end
#--------------------------------------------------------------------------
# * Update Tile
#--------------------------------------------------------------------------
def update_tile
# Remember tile ID, file name, and hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
# If tile ID value is valid
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
# If tile ID value is invalid
else
bmp = RPG::Cache.character(@character.character_name, @character.character_hue)
self.bitmap = Bitmap.new(bmp.width, bmp.height)
self.bitmap.blt(0, 0, bmp, Rect.new(0, 0, bmp.width, bmp.height))
@character.sexo.downcase == 'homem' ? px = 'H' : px = 'M'
ve = [RPG::Cache.character(@character.character_name, @character.character_hue),
RPG::Cache.character('Armor/' + px + $game_party.actors[0].armor3_id.to_s, @character.character_hue),
RPG::Cache.character('Helmet/' + px + $game_party.actors[0].armor2_id.to_s, @character.character_hue),
RPG::Cache.character('Shield/' + px + $game_party.actors[0].armor1_id.to_s, @character.character_hue),
RPG::Cache.character('Weapon/' + px + $game_party.actors[0].weapon_id.to_s, @character.character_hue),
RPG::Cache.character('Helmet/' + px + $game_party.actors[0].armor2_id.to_s, @character.character_hue)]
#=========================================================
if @character.is_a?(Game_NetPlayer)
for i in 0...ve.size
self.bitmap.blt(0, 0, ve[i], Rect.new(0, 0, bmp.width, bmp.height))
end
end
#=========================================================
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
#--------------------------------------------------------------------------
# * Update Player movement
#--------------------------------------------------------------------------
def animate_player
# Set rectangular transfer
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
#--------------------------------------------------------------------------
# * Update Animation
#--------------------------------------------------------------------------
def update_ani
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
Créditos
Paulo Soreto - Criador