Caixa de Texto Acima do Personagem
Página 1 de 1
Caixa de Texto Acima do Personagem
Character's Textbox
por Woratana
por Woratana
Características: Exibe uma caixa de texto acima do personagem e/ou evento.
Instruções: Cole acima do main e leia o começo do script para informações de como operá-lo.
Código:
- Código:
#===============================================================
# ● [VX] ◦ Character's Textbox ◦ □
# * Show textbox above character *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 21/05/2008
# ◦ Version: 1.0
# Traduçao para português: Rafidelis
# www.ReinoRpg.com
#--------------------------------------------------------------
#==================================================================
# ** RECURSOS **
#-----------------------------------------------------------------
#- Mostrar Caixa de texto acima do personagem (Player e / ou Evento)
#- Alterar a opacidade e a posição do texto (no script)
#- Utilizar efeito sonoro quando for mostrar texto (no script)
#==================================================================
# **COMO USAR **
# * Use o Evento Chamar Script...' para a linha abaixo de qualquer script ~ ~
#-----------------------------------------------------------------
# 1. Configure este Script na parte inferior do SETUP
# 2.Para mostrar a caixa de texto no character,chame o Script:
# set_text(character, new_text)
#
# * character: Em qual character você deseja mostrar a Caixa de Texto?
# ** -1Para o "jogador", 0 para "este evento', e 1 mais para o ID do Evento
# * new_text: Qual o texto que você deseja Exibir??
# ** Escrever o texto assim 'text here' or "text here"
# Exemplo:
# set_text(10,'Olá')
# *O Script acima ira mostrar o texto "Olá "no evento 10.
#
# 3. Para deletar/limpa a caixa de texto use o comando chamar Script e escreva:
# set_text(character, '')
#==================================================================
module Wora_CTB
#================================================================
# ** [START] Character's Overhead Textbox SETUP
#----------------------------------------------------------------
SAVE_TEXT = true # Savar texto na cixa de texto~? (true ou false)
# Se salvar,o texto velho sera exibido quando você se teleportar novamente para o mapa~
TEXTBOX_SKIN = 'Window' #Nome da WindowSkin,deve estar na pasta System.
TEXTBOX_OPACITY = 0 # Opacidade do Texto (0 - 255)
TEXTBOX_X_OFFSET = 0 #Mover o texto para a horizontal (+ or -)
TEXTBOX_Y_OFFSET = -1 # Mover texto para a vertical (+ or -)
TEXTBOX_POPSOUND_MODE = 2 # SE (Efeito de Som) para tocar quando o texto aparecer,
# ou mudar o texto~
# 0 para sem Som, 1 para usar som quando o primeiro texto aparecer,
# & para usar o som quando o primeiro testo aparecer e mudar o texto.
TEXTBOX_POPSOUND = 'Decision1' # Nome d SE
TEXTBOX_POPSOUND_VOLUME = 80 # Volume Da SE
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]
#==================================================================
Créditos:
Woratana
Rafidelis (Tradutor)
www.ReinoRpg.com
FUI!!!
Rodrigo Vernaschi- Administrador
- Número de Mensagens : 113
Idade : 30
Localização : Mauá-SP
Respeito às regras :
Premios :: 0
: 0
: 0
Reputação : 3
Pontos : 251
Data de inscrição : 27/02/2009
Ficha do personagem
Raça: Humano
Nível Maker: Experiente
Mensagem Pessoal: Leiam as regras! -
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|
» Chamar Bote
» Caixa de Texto Acima do Personagem
» Auto-Tile Speed
» Apresentação Antes do Title
» Anti-Hack System (Silver Link/Gold Link)
» Anti Hack (AMIGO X)
» Ajustar Volume Durante o Jogo
» Músicas e poemas