por Nanzin Dom Nov 06, 2011 6:01 pm
@Jonny > si ja esta global aki:
- Prova:
o que mudar?
coloque meu script acima e colque modifique o Script:
[SPR] Spriteset_NetCharacter
por esse:
- Código:
#==============================================================================
# ** 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 Marlos Gama
# Idea Destined
# Modified Nanzin
#==============================================================================
class Sprite_NetCharacter < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character # 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
if @character.flag == "cinco"
icon = RPG::Cache.icon("Mini-Flag5")
elsif @character.flag == "quatro"
icon = RPG::Cache.icon("Mini-Flag4")
elsif @character.flag == "treis"
icon = RPG::Cache.icon("Mini-Flag3")
elsif @character.flag == "dois"
icon = RPG::Cache.icon("Mini-Flag2")
elsif @character.flag == "um"
icon = RPG::Cache.icon("Mini-Flag1")
else
icon = RPG::Cache.icon("Mini-Flag1")
end
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, "[#{$game_party.actors[0].class_name}] " + @character.nome, 1)
# Draws Text
if @character.grupo == "Admin" and User_Edit::COLOR_ADMIN == true
bitmap.font.color = User_Edit::ADM_COLOR#Color.new(250, 250, 0)
else
bitmap.font.color = User_Edit::PLAYER_COLOR#Color.new(255, 255, 255)
end
bitmap.draw_text(0, 13, 160, 24, "[#{$game_party.actors[0].class_name}] " + @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 = "Segoe UI"
bitmap2.font.size = 15
bitmap2.fill_rect(1, 1, bitmap2.width-2, 23-9, 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, 23-2, 1, Color.new(255,255,255))
bitmap2.fill_rect(0, 1, 1, 23-10, Color.new(255,255,255))
bitmap2.fill_rect(bitmap2.width-1, 1, 1, 23-10, Color.new(255,255,255))
center = (bitmap2.width-8)/2
bitmap2.fill_rect(center, 23-8, 1, 8, Color.new(255,255,255))
bitmap2.fill_rect(center+1, 23-8, 1, 7, Color.new(255,255,255))
bitmap2.fill_rect(center+2, 23-8, 1, 6, Color.new(255,255,255))
bitmap2.fill_rect(center+3, 23-8, 1, 5, Color.new(255,255,255))
bitmap2.fill_rect(center+4, 23-8, 1, 4, Color.new(255,255,255))
bitmap2.fill_rect(center+5, 23-8, 1, 3, Color.new(255,255,255))
bitmap2.fill_rect(center+6, 23-8, 1, 2, Color.new(255,255,255))
bitmap2.fill_rect(center+7, 23-8, 1, 1, Color.new(255,255,255))
bitmap2.draw_text(2, 0, bitmap2.width-4, 16, msg1, 1)
message_sprite = Sprite.new(self.viewport)
message_sprite.bitmap = bitmap2
message_sprite.ox = bitmap2.width/2
message_sprite.oy = 84
message_sprite.opacity = 200
message_sprite.x = self.x
message_sprite.y = self.y
message_sprite.z = 999999
message_duration = 200
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 = 200
@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
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@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
Creditos: Marlos Gama (me Lembrou o script que transformava em global)
e Nanzin por terminar o sistema!
abraços