PoczątkującyVX - Sro 18 Sie, 2010 14:13 Temat postu: NazwyMam pytanie . A mianowicie czy się da zrobić tak , żeby u góry nad charsetem była nazwa jaką ja podam ? Da sie tak ? Jeśli tak to jak ?Amelanduil - Sro 18 Sie, 2010 14:29 Polecam skrypt woranty:
Spoiler:
Kod:
#===============================================================
# ● [VX] ◦ Character's Textbox ◦ □
# * Show textbox above character *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 22/12/2008
# ◦ Version: 2.0
#--------------------------------------------------------------
#==================================================================
# ** FEATURES **
#-----------------------------------------------------------------
# - Show Textbox above character (Player and/or Event)
# - Change textbox's opacity and position (in script)
# - Choose to use sound effect when show textbox (in script)
# - Fixed bug in version 1.0: Script hang when starting Scene_Battle
#==================================================================
# ** 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 = 2 # 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? and !@textbox.disposed?
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]
#==================================================================
PoczątkującyVX - Sro 18 Sie, 2010 14:33 I jak wkleję to do skryptu to jak potem , bo ja nigdy w skrypty sięnie bawiłem .Czeliosss - Sro 18 Sie, 2010 15:21 Jak wkleić skrypty to chyba powinieneś umieć, jak nie to masz to w Tutorialach [Vx].
Aby dać jakiś tekst nad postacią daj to:
set_text(-1, (nowy tekst))
zamiast (nowy tekst) wpisz co ma się pokazać
Aby wywołać ten skrypt wejdź w edytor mapy i zdarzenia.
Zrób nowy ev na paraell process i daj komendę Script [3 strona zdarzenia] i w polu wpisz tamten kod. Pod wywołaniem skryptu daj Erase Event.
To chyba wszystko.PoczątkującyVX - Sro 18 Sie, 2010 15:27 Ja mam vx polski wezme wywołaj skrpyt i napisz mi co muszę wkleić , aby pisało Sklepikarz .Czeliosss - Sro 18 Sie, 2010 15:35 Dobra.
Jak to ma się pokazywać nad naszą postacią, którą chodzimy to wywołaj:
set_text(-1, Sklepikarz)
A jak ma to być nad inną osobą, czyli NPC to wywołaj:
set_text(ID, Sklepikarz)
Id to ID zdarzenia, NPCPoczątkującyVX - Sro 18 Sie, 2010 15:55 Te id mam tak zostawić ?Czeliosss - Sro 18 Sie, 2010 16:27 Mówiłem, że ID masz podmienić na ID zdarzenia. Na Oknie zdarzenia na górze po lewej masz te ID.PoczątkującyVX - Sro 18 Sie, 2010 16:31 ID:001 ID podmieniłem na 001 i nie gra coś;/Czeliosss - Sro 18 Sie, 2010 17:01 masz wpisać 1 bez 0PoczątkującyVX - Sro 18 Sie, 2010 17:52 Czyli tak set_text(1, Sklepikarz)Czeliosss - Sro 18 Sie, 2010 17:59 Zgadza się.PoczątkującyVX - Sro 18 Sie, 2010 18:04 W wywołaj skrypt 3 zakładka lewa strona na samym dole tak ?
[ Dodano: Sro 18 Sie, 2010 19:06 ]
I jeszcze jedno . U mnie jest na kilku zdarzeniach ID:001Czeliosss - Sro 18 Sie, 2010 18:13 Napis będzie pokazywało na tej mapie co wywołałeś.PoczątkującyVX - Sro 18 Sie, 2010 18:22 No właśnie zrobiłem tak , że obrazek jakiegoś gościa i to jest sklepikarz w poleceniu nic nie ma prócz Skrypt:set_text(1, Sklepikarz) a sklep i dialog mam dwie kratki przed sklepikarzem , bo jest jeszcze lada , i typek musi wejść na tę jedno miejsce przed ladą i jak wcześniej pisałem ten sklepikarz ma , aby grafikę i w poleceniu skrypt sklepik jest gdzie indziej . Może przez to ?Czeliosss - Sro 18 Sie, 2010 19:22 Ma to tak wyglądać.
> Script: set_text(1, Sklepikarz)
> Earse Event
> Trigger
Paraell Process
Jak tak ustawisz to będzie dobrze. Nigdzie idziej nie dawaj tego kodu na mapie. A jak ma napis zniknąć to wywołaj:
set_text(1, )
Mam nadzieję, że nie masz już pytań.RATI - Sro 18 Sie, 2010 23:39 A po co komuś komplikować jak można prościej ;)
Wklej sobie ten skrypt:
Spoiler:
Kod:
#===============================================================
# ● [VX] ◦ Floating Event's Name ◦ □
# * Show event's name above event's head~! *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 16/11/2008
# ◦ Version: 1.0
#--------------------------------------------------------------
# ◦ How to use:
# - Put this script above Main.
# - Setup script below. Read it carefully.
# - Put the tag to show/hide floating name in the event's name
#=================================================================
class Sprite_Character < Sprite_Base
FLOAT_NAME_SHOW_ALL = false
# Do you want to show all event's name? (true / false)
# If false, event's name will only show on event that has text [FS] in name
# e.g. Event's name: Samurai01[FNS]
FLOAT_NAME_SHOW_TAG = '[FS]'
# Tag to show event's name when FLOAT_NAME_SHOW_ALL is false
FLOAT_NAME_NOT_SHOW_TAG = '[FNS]'
# Tag to not show event's name when FLOAT_NAME_SHOW_ALL is true
FLOAT_NAME_NOT_SHOW_WORDS = []
# Words you don't want to show in event's name.
# e.g. FLOAT_NAME_NOT_SHOW_WORDS = ['[ny]', '[ss]', 'lol']
# will not show words [ny], [ss], and lol in event's name.
# * Note: This is case sensitive!
FLOAT_NAME_X_OFFSET = 0 # Move event's name horizontally (+ or -)
FLOAT_NAME_Y_OFFSET = 0 # Move event's name vertically (+ or -)
FLOAT_NAME_Z = 198 # Move event's name above(+) / below(-) other objects
alias wora_floatevn_sprcha_dis dispose
alias wora_floatevn_sprcha_upd update
def dispose
if !@charname_box.nil? and @charname_box.is_a?(Sprite)
@charname_box.bitmap.dispose
@charname_box.dispose
end
wora_floatevn_sprcha_dis
end
def update
wora_floatevn_sprcha_upd
if @character.is_a?(Game_Event)
if @charname_box.nil?
# Show name
if (FLOAT_NAME_SHOW_ALL and !@character.event.name.include?(FLOAT_NAME_NOT_SHOW_TAG)) or
(!FLOAT_NAME_SHOW_ALL and @character.event.name.include?(FLOAT_NAME_SHOW_TAG))
# Remove Not Show Words
@float_charname = @character.event.name.dup
not_show_words = FLOAT_NAME_NOT_SHOW_WORDS.clone.push FLOAT_NAME_SHOW_TAG,
FLOAT_NAME_NOT_SHOW_TAG
not_show_words.each {|w| @float_charname.gsub!(w) {''} }
# Create Float Name Sprite
@charname_box = Sprite.new
@charname_box.z = FLOAT_NAME_Z
bitmap = Bitmap.new(1,1)
nsize = bitmap.text_size(@float_charname)
bitmap.dispose
@charname_box.bitmap = Bitmap.new(nsize.width, nsize.height)
@charname_box.bitmap.draw_text(0, 0, nsize.width, nsize.height,
@float_charname)
else
@charname_box = 0 # Not show name
end
end
# Update if float name box is Sprite
if @charname_box.is_a?(Sprite)
@charname_box.x = self.x - (@charname_box.width / 2) + FLOAT_NAME_X_OFFSET
@charname_box.y = self.y - self.oy - @charname_box.height + FLOAT_NAME_Y_OFFSET
end
end
end
end
class Game_Event < Game_Character
attr_reader :event
end
Następnie po prostu wejdź w event nad którym chcesz aby pojawiał się żądany napis i w oknie gdzie wpisujesz nazwę eventu (domyślnie jest "EVXXX" gdzie "XXX" to jego numer) wpisz "[FS]" po czym wpisz nazwę jaką chcesz nadać zdarzeniu. Odpalasz gierkę i masz nad zdarzeniem jego nazwę ;)PoczątkującyVX - Czw 19 Sie, 2010 07:24 RATI dzięki bo działa ale konkretnie mi chodziło o mniejszy troszeczke napis da sie tak ? PS . Grałes kiedyś w my fantasy online ? bo mi mniej więcej o takie coś chodzi .Amelanduil - Czw 19 Sie, 2010 14:05 Rati... ja ten skrypt w drugim poście dałem O.oRATI - Czw 19 Sie, 2010 16:00 Niet, dałeś inny ;)
Musiałbyś pogrzebać w skrypcie żeby zmniejszyć czcionkę.Sabikku - Czw 19 Sie, 2010 18:37 Znajdź ten fragment: