#==================================================================
# ** HOW TO USE **
# * use event command 'Script...' for the any script line below~
#-----------------------------------------------------------------
# 1. Setup this script in SETUP part below
# 2. To set text to character's textbox, call script:
# set_text(character, new_text)
#
# * character: What character you want to set this text?
# ** -1 for 'Player', 0 for 'This Event', and 1 or more for Event ID
# * new_text: What is the text you want to show?
# ** write text in 'text here' or "text here"
# For example:
# set_text(10,'Hello!')
# * Script above will show text 'Hello!' over event ID 10.
#
# 3. To clear textbox, call script:
# set_text(character, '')
#==================================================================
module Wora_CTB
#================================================================
# ** [START] Character's Overhead Textbox SETUP
#----------------------------------------------------------------
SAVE_TEXT = true # Save text in textbox~? (true or false)
# If save, old text will show when you teleport back to that map~
TEXTBOX_POPSOUND_MODE = 0 # SE (Sound Effect) to play when the textbox appear,
# or change text~
# 0 for no sound, 1 for use sound when textbox first appear,
# & 2 for use sound when textbox first appear and change text
TEXTBOX_POPSOUND = 'Decision1' # SE file name
TEXTBOX_POPSOUND_VOLUME = 80 # SE volume
TEXTBOX_POPSOUND_PITCH = 100 # SE pitch
#----------------------------------------------------------------
# ** [END] Character's Overhead Textbox SETUP
#================================================================
end
$worale = {} if $worale.nil?
$worale['Chartbox'] = true
class Game_Interpreter
def set_text(evid, new_text)
target = get_character(evid)
target.text = new_text
end
end
class Sprite_Character < Sprite_Base
alias wora_chartbox_sprcha_upd update
alias wora_chartbox_sprcha_dis dispose
def update
wora_chartbox_sprcha_upd
@chartext = '' if @chartext.nil?
if @character.text != @chartext # If there is new text
@chartext = @character.text
$game_system.chartbox = {} if $game_system.chartbox.nil?
case @character.class
when Game_Player; char_id = -1
when Game_Event; char_id = @character.id
end
# Save new text
$game_system.chartbox[[$game_map.map_id, char_id]] = @chartext
if @chartext == '' # If new text is empty? ('')
@textbox.visible = false if !@textbox.nil?
else # If new text is not empty~ change text
if @textbox.nil?
@textbox = Window_CharTBox.new
RPG::SE.new(Wora_CTB::TEXTBOX_POPSOUND, Wora_CTB::TEXTBOX_POPSOUND_VOLUME,
Wora_CTB::TEXTBOX_POPSOUND_PITCH).play if Wora_CTB::TEXTBOX_POPSOUND_MODE > 0
else
RPG::SE.new(Wora_CTB::TEXTBOX_POPSOUND, Wora_CTB::TEXTBOX_POPSOUND_VOLUME,
Wora_CTB::TEXTBOX_POPSOUND_PITCH).play if Wora_CTB::TEXTBOX_POPSOUND_MODE == 2
end
@textbox.set_text(@chartext)
@textbox.visible = true
end
end
if @chartext != ''
@textbox.x = self.x - (@textbox.width / 2) + Wora_CTB::TEXTBOX_X_OFFSET
@textbox.y = self.y - self.oy - @textbox.height + Wora_CTB::TEXTBOX_Y_OFFSET
end
end
def dispose
@textbox.dispose if !@textbox.nil?
wora_chartbox_sprcha_dis
end
end
class Game_Character
attr_accessor :text
alias wora_chartbox_gamcha_ini initialize
def initialize(*args)
wora_chartbox_gamcha_ini(*args)
$game_system.chartbox = {} if $game_system.chartbox.nil?
case self.class
when Game_Player
my_text = $game_system.chartbox[[$game_map.map_id, -1]] if
!$game_system.chartbox[[$game_map.map_id, -1]].nil?
when Game_Event
my_text = $game_system.chartbox[[$game_map.map_id, @id]] if
!$game_system.chartbox[[$game_map.map_id, @id]].nil?
end
@text = my_text.nil? ? '' : my_text
end
end
class Game_System
attr_accessor :chartbox
end
unless Wora_CTB::SAVE_TEXT
class Game_Interpreter
alias wora_chartbox_gamint_com201 command_201 unless $@
def command_201
if $game_map.fog_reset
if @params[0] == 0; id_map = @params[1]
else; id_map = $game_variables[@params[1]]
end
$game_system.chartbox = {} if id_map != @map_id
end
wora_chartbox_gamint_com201
end
end
end
#===============================================================
# Window_CharTBox: Edited version of Window_Help
#===============================================================
class Window_CharTBox < Window_Base
def initialize(x = 0, y = 0, w = 66, h = WLH+32)
super(x,y,w,h)
self.windowskin = Cache.system(Wora_CTB::TEXTBOX_SKIN)
self.opacity = Wora_CTB::TEXTBOX_OPACITY
end
def set_text(text)
if text != @text
text_w = self.contents.text_size(text).width
self.width = text_w + 32
create_contents
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, self.contents.width, WLH, text, 1)
@text = text
end
end
end
#==================================================================
# [END] VX Character Textbox by Woratana [woratana@hotmail.com]
#==================================================================
Po czym ustaw na pierwszej mapce zdarzenie. Trigger - Parallel process. A w zdarzeniu:
Wywołaj skrypt: set_text(-1, $game_actors[1].name)
[1] - ID bohatera którego nazwa jest wyświetlana.
Ustaw self switch A=ON
Utwórz drugą stronę na warunku Self Switch A is ON
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum