Qukus - Sob 02 Sty, 2010 19:04 Temat postu: Potrzebny skryptBardzo bym był wdzięczny gdyby ktoś dał by mi skrypt którym można stawić żeby nazwa osoby która mówi tekst pokazywała się w innym okienku np. nad tekstem który mówi. z góry dziękuję Teyan - Sob 02 Sty, 2010 19:14 Mam coś takiego tylko przetłumaczę. czekaj!!!!!!!!!!!!!!!!
[ Dodano: Pon 04 Sty, 2010 20:51 ]
Spoiler:
Kod:
#===============================================================================
# Nazwa: Custom Message System
# Autor: nieznany
# Tłumaczenie: Marcin (www.ultimateam.pl)
#
#===============================================================================
# Kod: Efrekt:
# \w[x] czeka X frames (60 frames = 1 sekunda).
#
# \nb[x] Tworzy okno z imieniem x. lewa strona
# \nbl[x] Tworzy okno z imieniem x. lewa strona
# \nbu[x] Tworzy okno z imieniem x. lewa strona
# \rnb[x] Tworzy okno z imieniem x. prawa strona
# \rnbl[x] Tworzy okno z imieniem x. prawa strona
# \rnbu[x] Tworzy okno z imieniem x. prawa strona
# \nbu Zamyka okno z imieniem.
#
# \fn[x] Zmienia czcionkę na x.
# \fs[x] Zmienia czcionkę na rozmiar X
# \fb Zmienia czcionkę na pogrubioną
# \fi Zmienia czcionkę na kursywę
# \fh Zmienia czcionkę na zaciemnioną
#
# \ac[x] czyta klasę aktora o id X
# \as[x] czyta subklasę aktora o id X. Potrzebny skrypt subklasy (nie wiem co to takiegp)
# \ax[x] czyta klasę aktora o id X. Potrzebny skrypt subklasy
# \af[x] zamiena twarze postaci
# \af[x:y] zamienia twarze postaci (lepiej przetestuj)
#
# \pn[x] czyta imie postaci w x miejscu w drużycie.
# \pc[x] czyta klase postaci w x miejscu w drużycie
# \ps[x] czyta subklase postaci w x miejscu w drużycie
# \px[x] czyta kombinację klass postaci w x miejscu w drużycie
# \pf[x] zamienia twarz z twarzą postaci w x miejscu w drużycie
# \pf[x:y] to co wyżej (przetestuj sobie)
#
# \nc[x] czyta nazwe klasy o ID x
# \ni[x] czyta nazwe itemu o ID x
# \nw[x] czyta nazwe broni o ID x
# \na[x] czyta nazwe pancerza o ID x
# \ns[x] czyta nazwe skilla o ID x
# \nt[x] czyta nazwe state (chyba chodzi o status) o ID x
#
# \i[x] wtyka ikonkę o ID x do wiadomości
# \ii[x] czyta nazwe itemu o ID x i wstawia jego ikonkę
# \iw[x] czyta broni itemu o ID x i wstawia jego ikonkę
# \ia[x] to co wyżej tylko chodzi o pancerz
# \is[x] a tutaj skill
# \it[x] no i status
#
#===============================================================================
#===============================================================================
# Credits:
# Woratana for reference on stringing multiple message text.
# Modern Algebra for reference on a few misc methods.
#===============================================================================
$imported = {} if $imported == nil
$imported["CustomMessageSystem"] = true
module YE
module MESSAGE
# Numer zmiennej (variable) jeżeli ustawimy jej wartość na np: 5 to wiadomości będą miały
# 5 linijek, możemy to zmienić w każdym momencie gry
ROW_VARIABLE = 14
# szerokość ikonek
ICON_WIDTH = 24
# Ustawienia okna imienia
NAME_WINDOW_X = 0 # Adjusts X position offset from Message Window.
NAME_WINDOW_Y = 40 # Adjusts Y position offset from Message Window.
NAME_WINDOW_W = 20 # Adjusts extra width added to the Name Window.
NAME_WINDOW_H = 40 # Adjusts the height of the Name Window.
NAME_COLOUR = 6 # Default colour used for name box.
# Chcesz oglądać okno imienia w wiadomości w skóre (tak - true, nie - false)
NAME_WINDOW_SHOW_BACK = true
# Zmienia ustawienia w całej grze.
FONT_NAME = ["Times New Roma", "Arial", "Courier New"]
FONT_SIZE = 16
FONT_BOLD = true
FONT_ITALIC = false
FONT_SHADOW = true
end # MESSAGE
end # YE
#~~~~~~~~~~~~~~DALEJ NIE TŁUMACZYŁEM
#===============================================================================
# How to Use: Lunatic Mode
#===============================================================================
#
# This portion is for those who know how to script.
#
# \X[x] or \X[x:y] or \X[x:y:z]
# These let you create your own custom tags. If you use the first tag, there is
# one case for the "custom_convert" definition to return. If you use the second
# tag, there will be two cases for you to select from. And likewise, if there's
# three tags, then the z case will also be taken into account of.
#
#===============================================================================
class Window_Message < Window_Selectable
def custom_convert(x_case, y_case = 0, z_case = 0)
text = ""
case x_case
#---------------------------------------------------------------------------
# //////////////////////////////////////////////////////////////////////////
# This is where you begin adding in your own custom converted tags.
#---------------------------------------------------------------------------
when 1 # Show the full name of the actor.
case y_case # This is the extra case for the actor.
when 1
text = "\\n[1] von Xiguel"
when 2
text = "Michelle \\n[2]"
when 3
text = "\\n[3] Manfred"
when 4
text = "\\n[4] Fernaeus"
end
when 2 # Show how much gold the party has.
text = $game_party.gold
when 3 # Show party's max level
text = $game_party.max_level
#---------------------------------------------------------------------------
# This is the part you guys shouldn't touch afterwards.
# //////////////////////////////////////////////////////////////////////////
#---------------------------------------------------------------------------""
end
return text
end
end # Window_Message
#===============================================================================
# Editting anything past this point may potentially result in causing computer
# damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
# Therefore, edit at your own risk.
#===============================================================================
#--------------------------------------------------------------------------
# alias dispose
#--------------------------------------------------------------------------
alias dispose_cms dispose unless $@
def dispose
dispose_cms
@name_window.dispose if @name_window != nil
@name_text.dispose if @name_text != nil
end
#--------------------------------------------------------------------------
# close
#--------------------------------------------------------------------------
def close
super
@name_window.close
@name_text.close
@name_window_lock = false
end
#--------------------------------------------------------------------------
# alias update
#--------------------------------------------------------------------------
alias update_cms update unless $@
def update
@name_window.update
@name_text.update
refresh_size
update_cms
end
#--------------------------------------------------------------------------
# refresh_size
#--------------------------------------------------------------------------
def refresh_size
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
@max_rows = (var <= 0) ? 4 : var
calc_height = @max_rows * 24 + 32
if self.height != calc_height
self.height = calc_height
create_contents
end
end
#--------------------------------------------------------------------------
# overwrite reset_window
#--------------------------------------------------------------------------
def reset_window
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
@background = $game_message.background
@position = $game_message.position
self.opacity = (@background == 0) ? 255 : 0
case @position
when 0 # Top
self.y = 0
@gold_window.y = 360
when 1 # Middle
self.y = (Graphics.height - wheight) / 2
@gold_window.y = 0
when 2 # Bottom
self.y = (Graphics.height - wheight)
@gold_window.y = 0
end
end
#-------------------------------------------------------------
# Name box REGEXP Conversions
#-------------------------------------------------------------
@text.gsub!(/\\NB\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
end
"" }
@text.gsub!(/\\NBL\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
@name_window_lock = true
end
"" }
@text.gsub!(/\\NBU\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s)
@name_window_lock = false
end
"" }
@text.gsub!(/\\NBU/i) {
@name_window.close
@name_text.close
@name_window_lock = false
"" }
@text.gsub!(/\\RNB\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
end
"" }
@text.gsub!(/\\RNBL\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
@name_window_lock = true
end
"" }
@text.gsub!(/\\RNBU\[(.*?)\]/i) {
if $1.to_s != nil
refresh_name_box($1.to_s, 1)
@name_window_lock = false
end
"" }
# Close the Name Window
unless @name_window_lock
@name_window.close if !@name_window_open
@name_text.close if !@name_window_open
end
end
#--------------------------------------------------------------------------
# overwrite update_message
#--------------------------------------------------------------------------
def update_message
loop do
text_height = [contents.font.size + (contents.font.size / 5), WLH].max
c = @text.slice!(/./m) # Get next text character
case c
#----------------------------------------------------------------------
# Default Cases
#----------------------------------------------------------------------
when nil # There is no text that must be drawn
finish_message # Finish update
break
when "\x00" # New line
new_line
if @line_count >= @max_rows # If line count is maximum
unless @text.empty? # If there is more
self.pause = true # Insert number input
break
end
end
when "\x01" # \C[n] (text character color change)
@text.sub!(/\{(\d+)\}/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02" # \G (gold display)
@gold_window.refresh
@gold_window.open
when "\x03" # \. (wait 1/4 second)
@wait_count = 15
break
when "\x04" # \| (wait 1 second)
@wait_count = 60
break
when "\x05" # \! (Wait for input)
self.pause = true
break
when "\x06" # \> (Fast display ON)
@line_show_fast = true
when "\x07" # \< (Fast display OFF)
@line_show_fast = false
when "\x08" # \^ (No wait for input)
@pause_skip = true
#----------------------------------------------------------------------
# New Cases
#----------------------------------------------------------------------
when "\x09" # \| Wait x frames
@text.sub!(/\{(\d+)\}/, "")
@wait_count = $1.to_i
break
when "\x10" # \i Draws icon ID x
@text.sub!(/\{(\d+)\}/, "")
icon = $1.to_i
icon_width = (24 - YE::MESSAGE::ICON_WIDTH) / 2
draw_icon(icon, @contents_x - icon_width, @contents_y)
@contents_x += YE::MESSAGE::ICON_WIDTH
when "\x11" # \fs Font Size Change
@text.sub!(/\{(\d+)\}/, "")
size = $1.to_i
if size <= 0 # If 0, revert back to the default font size.
size = Font.default_size
end
contents.font.size = size
text_height = [size + (size / 5), WLH].max
when "\x12" # \fs Font Name Change
@text.sub!(/\{(.*?)\}/, "")
name = $1.to_s
if name == "0" # If 0, revert back to the default font.
name = Font.default_name
end
contents.font.name = name
when "\x13" # \fb Font bold
contents.font.bold = contents.font.bold ? false : true
when "\x14" # \fi Font italic
contents.font.italic = contents.font.italic ? false : true
when "\x15" # \fi Font shadowed
contents.font.shadow = contents.font.shadow ? false : true
#----------------------------------------------------------------------
# Finish Up
#----------------------------------------------------------------------
else # Normal text character
contents.draw_text(@contents_x, @contents_y, 40, text_height, c)
c_width = contents.text_size(c).width
@contents_x += c_width
end
break unless @show_fast or @line_show_fast
end
end
#--------------------------------------------------------------------------
# alias new_page
#--------------------------------------------------------------------------
alias new_page_cms new_page unless $@
def new_page
new_page_cms
contents.font.name = Font.default_name
contents.font.size = Font.default_size
contents.font.bold = Font.default_bold
contents.font.italic = Font.default_italic
contents.font.shadow = Font.default_shadow
end
#--------------------------------------------------------------------------
# combination_class
#--------------------------------------------------------------------------
def combination_class(actor)
return "" if actor == nil
class1 = actor.class.name
return class1 unless $imported["SubclassSelectionSystem"]
return class1 if actor.subclass == nil
class2 = actor.subclass.name
text = sprintf(YE::SUBCLASS::DISPLAY_FORMAT, class1, class2)
return text unless YE::SUBCLASS::USE_COMPLEX_CLASS_NAMES
if YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL.include?(text)
text = YE::SUBCLASS::COMPLEX_CLASS_NAMES_FULL[text]
end
return text
end
#--------------------------------------------------------------------------
# refresh_name_box
#--------------------------------------------------------------------------
def refresh_name_box(name, side = 0)
return if $game_temp.in_battle
font_colour = YE::MESSAGE::NAME_COLOUR
font_name = Font.default_name
font_size = Font.default_size
font_bold = Font.default_bold
font_italic = Font.default_italic
font_shadow = Font.default_shadow
icon = 0
name_width = 0
#---Convert Special Characters
name = name.gsub(/\x01\{(\d+)\}/i) {
font_colour = $1.to_i
""}
name = name.gsub(/\x09\{(\d+)\}/i) {""}
name = name.gsub(/\x10\{(\d+)\}/i) {
icon = $1.to_i
name_width += YE::MESSAGE::ICON_WIDTH
""}
name = name.gsub(/\x11\{(\d+)\}/i) {
font_size = $1.to_i
""}
name = name.gsub(/\x12\{(.*?)\}/i) {
font_name = $1.to_s
""}
name = name.gsub(/\x13/i) {
font_bold = true
""}
name = name.gsub(/\x14/i) {
font_italic = true
""}
name = name.gsub(/\x15/i) {
font_shadow = true
""}
#---Convert Special Characters
@name_text.contents.font.name = font_name
@name_text.contents.font.size = font_size
@name_text.contents.font.bold = font_bold
@name_text.contents.font.italic = font_italic
@name_text.contents.font.shadow = font_shadow
name_width += @name_text.contents.text_size(name).width
name_width += YE::MESSAGE::NAME_WINDOW_W
@name_window.width = name_width + 40
@name_text.width = @name_window.width
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
position = $game_message.position
case position
when 0
@name_window.y = self.height - YE::MESSAGE::NAME_WINDOW_H
@name_window.y += YE::MESSAGE::NAME_WINDOW_Y
when 1
@name_window.y = (Graphics.height - wheight) / 2
@name_window.y -= YE::MESSAGE::NAME_WINDOW_Y
when 2
@name_window.y = (Graphics.height - wheight)
@name_window.y -= YE::MESSAGE::NAME_WINDOW_Y
end
offset = (@name_text.height - @name_window.height) / 2
@name_text.y = @name_window.y - offset
if YE::MESSAGE::NAME_WINDOW_SHOW_BACK and $game_message.background == 0
@name_window.opacity = 255
else
@name_window.opacity = 0
end
if side == 0
@name_window.x = YE::MESSAGE::NAME_WINDOW_X
else
@name_window.x = Graphics.width - YE::MESSAGE::NAME_WINDOW_X
@name_window.x -= @name_window.width
end
@name_text.x = @name_window.x
@name_window.create_contents
@name_text.create_contents
txh = [font_size + (font_size / 5), WLH].max
@name_text.contents.font.color = text_color(font_colour)
@name_text.contents.font.name = font_name
@name_text.contents.font.size = font_size
@name_text.contents.font.bold = font_bold
@name_text.contents.font.italic = font_italic
@name_text.contents.font.shadow = font_shadow
if icon > 0
iw = YE::MESSAGE::ICON_WIDTH
@name_text.draw_icon(icon, YE::MESSAGE::NAME_WINDOW_W / 2, 0)
@name_text.contents.draw_text(iw, 0, name_width + 8 - iw, txh, name, 1)
else
@name_text.contents.draw_text(0, 0, name_width + 8, txh, name, 1)
end
@name_window.open
@name_text.open
@name_window_open = true
end
#--------------------------------------------------------------------------
# overwrite Show Text
#--------------------------------------------------------------------------
def command_101
unless $game_message.busy
$game_message.face_name = @params[0]
$game_message.face_index = @params[1]
$game_message.background = @params[2]
$game_message.position = @params[3]
flow = true
loop {
if @list[@index].code == 101 and meet_stringing_conditions and flow
@index += 1
else
break
end
flow = @row_check
while @list[@index].code == 401 and meet_stringing_conditions
$game_message.texts.push(@list[@index].parameters[0])
@index += 1
end }
if @list[@index].code == 102 # Show choices
setup_choices(@list[@index].parameters)
elsif @list[@index].code == 103 # Number input processing
setup_num_input(@list[@index].parameters)
end
set_message_waiting # Set to message wait state
end
return false
end
#--------------------------------------------------------------------------
# overwrite setup_choices
#--------------------------------------------------------------------------
def setup_choices(params)
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
rows = (var <= 0) ? 4 : var
if $game_message.texts.size <= rows - params[0].size
$game_message.choice_start = $game_message.texts.size
$game_message.choice_max = params[0].size
for s in params[0]
$game_message.texts.push(s)
end
$game_message.choice_cancel_type = params[1]
$game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
@index += 1
end
end
#--------------------------------------------------------------------------
# meet_stringing_conditions
#--------------------------------------------------------------------------
def meet_stringing_conditions
var = $game_variables[YE::MESSAGE::ROW_VARIABLE]
rows = (var <= 0) ? 4 : var
@row_check = (rows > 4) ? true : false
return true if rows > $game_message.texts.size
return false
end
end # Game_Interpreter
#===============================================================================
#
# END OF FILE
#
#===============================================================================
Qukus - Pią 08 Sty, 2010 19:27 Wielkie dzięki niestety (a może stety) nie pracuje nad tą grą wziąłem się za programowanie ale prawdopodobnie kiedyś tu powrócę... xD