Event Text Display

Death10

;D
Member
Joined
Jul 18, 2012
Messages
29
Reaction score
5
First Language
Vietnamese
Primarily Uses
Event Text Display




Author: Áص¹ (RGSS)




Edited by Death10 (RGSS3)




Introduction




-Display text above Actor and Event




Features




-New nickname line




-Can update in map




Script




Comment in Event Page: [ETDname][NNnickname]




#==============================================================================
# ** 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, 255)

ETD_Default_PlayerText = 'name'

ETD_Default_PlayerText2 = 'nickname'

#--------------------------------------------------------------------------

# * 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.code == 108

@list.parameters[0].dup.gsub!(/\[[Ee][Tt][Dd](.+?)\]/) do

@etd_display_color = ETD_Default_EventText_Color

@etd_display_text = $1

end

if @list.code == 108

@list.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 = 22

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 = 22

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 = 20

@_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


Screenshot







FAQ


-Remove the game actor name and nickname:Change


Code:
[I]ETD_Default_PlayerText = 'name'[/I]
[I]ETD_Default_PlayerText2 = 'nickname'[/I]
to



Code:
[I]ETD_Default_PlayerText = ''[/I]
[I]ETD_Default_PlayerText2 = ''[/I]
 

DrikoRios

Warper
Member
Joined
Mar 12, 2014
Messages
3
Reaction score
0
First Language
português
Primarily Uses
Hello! It would be possible to add level as char of the group, and to the monsters of database? 

 

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly! I will be beginning a play-through of Resident Evil 4! Feel free to drop by!

1st iteration on castle interior in Tiled.
I've started up Pillars of Eternity. It's interesting how the game does a "select choice" cutscene using still image art for dramatic flair. I wonder if that might work for my RPGMaker project.
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?

Forum statistics

Threads
107,737
Messages
1,031,754
Members
139,874
Latest member
anonymous_game_dev
Top