Event Text Display
Introdução
Coloca um nome qualquer em cima do char e de qualquer NPC
Instruções
Para mudar oq aparece em cima do char procure esta linha
when 'Name'
txt = "Escreva aqui"
apague oq está entre aspas e escreva oq vc qr q apareça em cima do char.
Agora para vc colokar alguma coisa em cima de um evento, crie um evento e no evento crie um comentário e escreva isto
[CD Escreva aki]
onde está escrito "Escreva aki" apague e coloq oq vc qiserq apareça em cima do evento
Script
- Código:
#==============================================================================
# ** Event Text Display
#==============================================================================
# Created By: Áص¹
# Modified By: SephirothSpawn
# Modified By: Me™
# Version 2.1
# 2006-03-04
#==============================================================================
# * Instructions :
#
# ~ Creating Event With Text Display
# - Put a Comment on the Page With
# [CD____]
# - Place Text to Be Displayed in the Blank
#------------------------------------------------------------------------------
# * Customization :
#
# ~ NPC Event Colors
# - Event_Color = Color
#
# ~ Player Event Color
# - Player_Color = Color
#
# ~ Player Text
# - Player_Text = text_display *
#
# ~ text_display
# - 'Name', 'Class', 'Level', 'Hp', 'Sp'
#==============================================================================
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Dispaly Text Color (Event & Player)
#--------------------------------------------------------------------------
Event_Color = Color.new(0, 0, 200)
Player_Color = Color.new(200, 0, 0)
#--------------------------------------------------------------------------
# * Display Choices
# ~ 'Name', 'Class', 'Level', 'Hp', 'Sp'
#--------------------------------------------------------------------------
Player_Text = 'Name'
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :text_display
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_gevent_refresh refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_characterdisplay_gevent_refresh
# Checks to see if display text
# If the name contains CD, it takes the rest of the name as the text
unless @list.nil?
for i in 0...@list.size
if @list.code == 108
@list.parameters[0].dup.gsub!(/\[[Cc][Dd](.+?)\]/) do
@text_display = [$1, Event_Color]
end
end
end
end
@text_display = nil if @erased
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_gplayer_refresh refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_characterdisplay_gplayer_refresh
# Gets First Actor
actor = $game_party.actors[0]
# Determines Text
case Player_Text
when 'Name'
txt = "Escreva aqui"
when 'Class'
txt = actor.class_name
when 'Level'
txt = "Level: #{actor.level}"
when 'Hp'
txt = "HP: #{actor.hp} / #{actor.maxhp}"
when 'Sp'
txt = "SP: #{actor.sp} / #{actor.maxsp}"
else
txt = ''
end
# Creates Text Display
@text_display = [txt, Player_Color]
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_characterdisplay_scharacter_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original update Method
seph_characterdisplay_scharacter_update
# Character Display Update Method
update_display_text
end
#--------------------------------------------------------------------------
# * Create Display Sprite
#--------------------------------------------------------------------------
def create_display_sprite(args)
Font.default_size = 12
Font.default_name = "Verdana"
# Creates Display Bitmap
bitmap = Bitmap.new(160, 24)
# Draws Text Shadow
if bitmap.font.respond_to?(:draw_shadow)
bitmap.font.draw_shadow = true
end
bitmap.font.color = Color.new(0, 0, 0)
bitmap.draw_text(1, 1, 160, 24, args[0], 1)
# Changes Font Color
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.ox = 80
@_text_display.oy = 24
@_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
#--------------------------------------------------------------------------
# * Dispose Display Sprite
#--------------------------------------------------------------------------
def dispose_display_text
unless @_text_display.nil?
@_text_display.dispose
end
#reset font colors
Font.default_size = 14
Font.default_name = "Verdana"
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
unless @character.text_display.nil?
if @_text_display.nil?
create_display_sprite(@character.text_display)
end
@_text_display.x = self.x
@_text_display.y = self.y - self.oy / 2 - 24
lastx = $game_temp.player_new_x
lasty = $game_temp.player_new_y
# if self.x > lastx and self.y > lasty
# @_text_display.opacity = 255 - (self.x - lastx) - (self.y - lasty)
# elsif self.x < lastx and self.y > lasty
# @_text_display.opacity = 255 - (lastx - self.x) - (self.y - lasty)
# elsif self.x > lastx and self.y < lasty
# @_text_display.opacity = 255 - (self.x - lastx) - (lasty - self.y)
# else
# @_text_display.opacity = 255 - (lastx - self.x) - (lasty - self.y)
# end
else
unless @_text_display.nil?
dispose_display_text
end
end
#reset font colors
Font.default_size = 14
Font.default_name = "Verdana"
end
end
Creditos:
Áص¹
SephirothSpawn
Me™