Olá galera, tudo certo? Então, queria pedir ajuda para modificar o script abaixo. Ele tem como função adicionar informações do herói, como level e nome. E também adiciona nome acima de eventos. O que eu queria modificar é o seguinte, queria poder usar a função para também mostrar nome e level no segundo herói da party, e também nos inimigos da database. Desde já agradeço!
- Código:
#==============================================================================
# ** Event Text Display
#==============================================================================
# Author: Áص¹ (RGSS)
# Edited by Death10 (RGSS3)
# http://gamesvts.com
# http://taotrochoi.com
#==============================================================================
# Comment: [ETDname][NNnickname]
#==============================================================================
#==============================================================================
# ** Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Defaults
#
# ~ Default Player Display Options (Non-Case Sensitive):
# 'Name', 'Nickname', 'Class', 'Level', 'Hp', 'Sp'
#--------------------------------------------------------------------------
ETD_Default_EventText_Color = Color.new(255, 255, 255)
ETD_Default_PlayerText_Color = Color.new(255, 255, 255)
ETD_Default_EventText_Color2 = Color.new(255, 255, 255)
ETD_Default_PlayerText_Color2 = Color.new(255, 255, 0)
ETD_Default_PlayerText = 'name'
ETD_Default_PlayerText2 = 'level'
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :etd_display_shadow_color
attr_accessor :etd_display_color
attr_accessor :etd_display_text
attr_accessor :etd_display_shadow_color2
attr_accessor :etd_display_color2
attr_accessor :etd_display_text2
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_etd_gmchr_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Sets ETD Options
@etd_display_color = self.is_a?(Game_Player) ?
ETD_Default_PlayerText_Color : ETD_Default_EventText_Color
@etd_display_color2 = self.is_a?(Game_Player) ?
ETD_Default_PlayerText_Color2 : ETD_Default_EventText_Color2
# Original Initialization
seph_etd_gmchr_init
end
end
#==============================================================================
# ** Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_etd_gmevt_refresh refresh
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Original Refresh Method
seph_etd_gmevt_refresh
# Erase ETD Display Text
@etd_display_text = nil
@etd_display_text2 = nil
# Checks to see if display text
unless @list.nil? || @erased
for i in 0...@list.size
if @list[i].code == 108
@list[i].parameters[0].dup.gsub!(/\[[Ee][Tt][Dd](.+?)\]/) do
@etd_display_color = ETD_Default_EventText_Color
@etd_display_text = $1
end
if @list[i].code == 108
@list[i].parameters[0].dup.gsub!(/\[[Nn][Nn](.+?)\]/) do
@etd_display_color2 = ETD_Default_EventText_Color2
@etd_display_text2 = $1
end
end
end
end
end
end
end
#==============================================================================
# ** Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias seph_etd_gmplyr_refresh refresh
alias etd_update update
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def etd
# Gets First Actor
actor = $game_party.members[0]
# Determines Text
case ETD_Default_PlayerText.dup.downcase
when 'name' ; txt = actor.name
when 'nickname' ; txt = actor.nickname
when 'class' ; txt = actor.class.name
when 'level' ; txt = "Level: #{actor.level}"
when 'hp' ; txt = "HP: #{actor.hp} / #{actor.mhp}"
when 'sp' ; txt = "SP: #{actor.sp} / #{actor.msp}"
else ; txt = ''
end
# Determines Text
case ETD_Default_PlayerText2.dup.downcase
when 'name' ; txt2 = actor.name
when 'nickname' ; txt2 = actor.nickname
when 'class' ; txt2 = actor.class.name
when 'level' ; txt2 = "Level: #{actor.level}"
when 'hp' ; txt2 = "HP: #{actor.hp} / #{actor.mhp}"
when 'sp' ; txt2 = "SP: #{actor.sp} / #{actor.msp}"
else ; txt2 = ''
end
# Creates Text Display
@etd_display_color = ETD_Default_PlayerText_Color
@etd_display_text = txt
@etd_display_color2 = ETD_Default_PlayerText_Color2
@etd_display_text2 = txt2
end
def refresh
seph_etd_gmplyr_refresh
etd
end
def update
etd_update
etd
end
end
#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @seph_etd_spchr.nil?
alias seph_etd_spchr_update update
alias seph_etd_spchr_dispose dispose
@seph_etd_spchr = true
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Original update Method
seph_etd_spchr_update
# Character Display Update Method
update_display_text
update_display_text2
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
# Original Dispose
seph_etd_spchr_dispose
# Dispose ETD Sprite
dispose_etd_sprite
dispose_etd_sprite2
end
#--------------------------------------------------------------------------
# * Dispose ETD Sprite
#--------------------------------------------------------------------------
def dispose_etd_sprite
# Dispose ETD Sprite
unless @_etd_text_sprite.nil?
@_etd_text_sprite.dispose
@_etd_text_sprite = nil
end
end
def dispose_etd_sprite2
# Dispose ETD Sprite
unless @_etd_text_sprite2.nil?
@_etd_text_sprite2.dispose
@_etd_text_sprite2 = nil
end
end
#--------------------------------------------------------------------------
# * Update Display Sprite
#--------------------------------------------------------------------------
def update_display_text
# If Character Has No ETD
if @character.etd_display_text.nil?
# Dispose ETD Sprite
dispose_etd_sprite
return
end
# If ETD Text Sprite Doesn't Exist
if @_etd_text_sprite.nil?
# Create ETD Text Sprite
create_etd_sprite
return
end
# If ETD Sprite Parameters Don't Match Characters
unless @_etd_display_text == @character.etd_display_text &&
@_etd_display_color == @character.etd_display_color &&
@_etd_display_shadow_color == @character.etd_display_shadow_color
# Dispose Sprite
dispose_etd_sprite
# Recreate Sprite
create_etd_sprite
end
# Update ETD Sprite Position
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 41
end
def update_display_text2
# If Character Has No ETD
if @character.etd_display_text2.nil?
# Dispose ETD Sprite
dispose_etd_sprite2
return
end
# If ETD Text Sprite Doesn't Exist
if @_etd_text_sprite2.nil?
# Create ETD Text Sprite
create_etd_sprite2
return
end
# If ETD Sprite Parameters Don't Match Characters
unless @_etd_display_text2 == @character.etd_display_text2 &&
@_etd_display_color2 == @character.etd_display_color2 &&
@_etd_display_shadow_color2 == @character.etd_display_shadow_color2
# Dispose Sprite
dispose_etd_sprite2
# Recreate Sprite
create_etd_sprite2
end
# Update ETD Sprite Position
@_etd_text_sprite2.x = self.x
@_etd_text_sprite2.y = self.y - self.oy / 2 - 24
end
#--------------------------------------------------------------------------
# * Create ETD Sprite
#--------------------------------------------------------------------------
def create_etd_sprite
# Creates Display Bitmap
bitmap = Bitmap.new(162, 40)
# Draws ETD Display Text
bitmap.font.color = @character.etd_display_color
bitmap.font.size = 15
bitmap.draw_text(0, 0, 161, 40, @character.etd_display_text, 1)
# Creates Display Text Sprite
@_etd_text_sprite = Sprite.new(self.viewport)
@_etd_text_sprite.bitmap = bitmap
@_etd_text_sprite.ox = 80
@_etd_text_sprite.oy = 20
@_etd_text_sprite.x = self.x
@_etd_text_sprite.y = self.y - self.oy / 2 - 41
@_etd_text_sprite.z = 3000
@_etd_text_sprite.visible = true
# Saves ETD Text
@_etd_display_text = @character.etd_display_text
@_etd_display_color = @character.etd_display_color
@_etd_display_shadow_color = @character.etd_display_shadow_color
end
def create_etd_sprite2
# Creates Display Bitmap
bitmap2 = Bitmap.new(162, 40)
# Draws ETD Display Text
bitmap2.font.color = @character.etd_display_color2
bitmap2.font.size = 15
bitmap2.draw_text(0, 0, 161, 40, @character.etd_display_text2, 1)
# Creates Display Text Sprite
@_etd_text_sprite2 = Sprite.new(self.viewport)
@_etd_text_sprite2.bitmap = bitmap2
@_etd_text_sprite2.ox = 80
@_etd_text_sprite2.oy = 22
@_etd_text_sprite2.x = self.x
@_etd_text_sprite2.y = self.y - self.oy / 2 - 24
@_etd_text_sprite2.z = 3000
@_etd_text_sprite2.visible = true
# Saves ETD Text
@_etd_display_text2 = @character.etd_display_text2
@_etd_display_color2 = @character.etd_display_color2
@_etd_display_shadow_color2 = @character.etd_display_shadow_color2
end
end