|
|||||||
![]() |
|
|
Herramientas | Desplegado |
|
||||
|
Ahí voy:
Mansage Ex:
Spoiler
=begin
MESSAGE EX #================================================= ============================== # By Xiderowg / 桜雅 在土 # http://xms.rdy.jp/ # http://scriptshelf.jpn.org/x/ #================================================= ============================== FUNÇÃO Sistema avançado de apresentação de mensssagens. UTILIZAÇÃO Os códigos devem ser colocados na janela de mensagens Nota I - Quando estiver escrito n no código significa que você deve colocar um numero. -------------------------------------------------------------------------------- JANELA INFORMATIVA \Info Permite que a janela se estenda até os limites da tela -------------------------------------------------------------------------------- DEIXAR A JANELA DE MENSAGEM PERMANENTE NA TELA \hold -------------------------------------------------------------------------------- EFEITO FADE APÓS O TERMINIO DA MENSSAGEM \fade O Texto desaparece lentamente -------------------------------------------------------------------------------- APRESENTAR UMA JANELA SEPARADA COM NOME \name[NOME] No lugar do nome coloque o nome do personagem. -------------------------------------------------------------------------------- POSIÇÃO DA JANELA \p[n] No lugar do n coloque o numero ID do evento para que a janela se posicione no evento. Caso quiser que a janela se posicione no herói coloque 0 -------------------------------------------------------------------------------- TEXTO CENTRALIZADO \center -------------------------------------------------------------------------------- TEXTO DO LADO DIREITO \right -------------------------------------------------------------------------------- FONTE EM NEGRITO \B -------------------------------------------------------------------------------- TAMANHO DA FONTE \h[n] No lugar do n coloque o valor do tamanho da fonte de 6 a 32 -------------------------------------------------------------------------------- TRANSPARÊNCIA DA FONTE \o[n] No lugar do n coloque o valor da transparência (De 0 a 255) -------------------------------------------------------------------------------- ADICIONAR ESPAÇO \b[n] -------------------------------------------------------------------------------- PULAR UMA LINHA PARA BAIXO \n -------------------------------------------------------------------------------- JUNTAR VÁRIAS JANELAS DE MENSAGENS EM APENAS UMA JANELA, \next Logo que terminar de escrever a ultima sentença do texto coloque o código \next para poder juntar a próxima janela. -------------------------------------------------------------------------------- MOSTRAR FACE DE UM PERSONAGEM \f[NOME] No lugar do nome coloque o nome do arquivo de imagem, este arquivo deve estar na pasta pictures. É possível usar o código desta maneira \f[NOME,n] O código permite apresentar a face por parte divididas de 1 à 16. Exemplo \f[Alex,4] No exemplo o script vai dividir a imagem por 16 e vai apresentar a parte numero 4. -------------------------------------------------------------------------------- VELOCIDADE DA MENSAGEM \s[n] No lugar do n coloque a valor numérico da velocidade (de 0 a 19) -------------------------------------------------------------------------------- APRESENTAR O VALOR DA VARIÁVEL \v[n] No lugar do n coloque o numero ID da variável -------------------------------------------------------------------------------- APRESENTAR DINHEIRO \g -------------------------------------------------------------------------------- FONTE EM ITÁLICO \I -------------------------------------------------------------------------------- PAUSA ENTRE UMA PALAVRA E OUTRA \! -------------------------------------------------------------------------------- FECHAMENTO AUTOMÁTICO DA JANELA \~ -------------------------------------------------------------------------------- APRESENTAR O NOME DO PERSONAGEM \n[n] No lugar do n coloque o numero ID do personagem. -------------------------------------------------------------------------------- COR DO TEXTO \c[n] No lugar do n coloque estes números. 0 = Branco 1 = Azul escuro 2 = Vermelho 3 = Verde 4 = Azul claro 5 = Roxo 6 = Amarelo -------------------------------------------------------------------------------- MOVER-SE ENQUANTO A MENSAGEM ESTÁ ATIVA \pass Permite que o personagem possa se mover enquanto a janela de mensagem estiver ativa -------------------------------------------------------------------------------- APRESENTAR NOMES DOS ITENS,ARMAS e ARMADURAS + A IMAGEM DO ÍCONE \V[] Permite apresentar o nome e a imagem do ícone dos itens,armaduras e armas. Dentro dos colchetes coloque estas letras seguidas do seu numero ID. i = Item w = Arma a = Armadura(Equipamento de defesa. Exemplo de uso --------- \V[i3] --------- No exemplo definimos que a imagem ira apresentar o item numero ID 3, que corresponde ao Full Potion -------------------------------------------------------------------------------- CARACTERES EM PICTURES \e[n] Apresenta uma letra em pictures de 24x24, permitindo a possibilidades de colocar qualquer tipo caractere que desejar, inclusive com textura. É necessário ter uma imagem com o nome de Gaiji.png na pasta pictures. A imagem deve ter de 24 de altura, por X de largura. O n é a posição que o script vai ler o arquivo de imagem, ou seja,caso colocarmos o código \e[2] o mensagem vai apresentar a imagem do arquivo na posição 60 de largura. -------------------------------------------------------------------------------- =end class Window_Message < Window_Selectable # Nome da fonte das letras da janela de mensagem. DEFAULT_FONT_NAME = "Arial" # Tamanho da fonte da janela de mensagem. DEFAULT_FONT_SIZE = 18 # Espaço entre uma linha de texto e outra. DEFAULT_LINE_SPACE = 28 # Nome do arquivo de imagem que ficará atrás da janela de mensagem DEFAULT_BG_PICTURE = "" # Posição da imagem padrão na horizontal. DEFAULT_BG_X = 0 # Posição da imagem padrão na vertical. DEFAULT_BG_Y = 320 # Rect.new (X, Y, L, A) # X = Posição na horizontal. # Y = Posição na vertical. # L = Largura da janela. # A = Altura da janela. DEFAULT_RECT = Rect.new(80, 304, 496, 160) # Transparência da janela de mensagem, de 0 a 255. DEFAULT_BACK_OPACITY = 160 # Ajuste automático do tamanho da janela, ou seja, caso você escrever #além dos limites do tamanho da janela, o script vai ajustar #automaticamente o tamanho da janela conforme o tamanho da fonte e #a quantidade de letras, coloque true ou false. DEFAULT_STRETCH_ENABLE = true # Extender tamanho da janela. INFO_RECT = Rect.new(-16, 64, 672, DEFAULT_LINE_SPACE + 40) # Janela de informação # Rect.new (X, Y, L, A, DEFAULT_LINE_SPACE) # X = Posição na horizontal. # Y = Posição na vertical. # L = Largura da janela. # A = Altura da janela. # DEFAULT_LINE_SPACE = Espaço entre as extremidades da linha. DEFAULT_TYPING_ENABLE = true # Ativar apresentação de leitura de letras, coloque false se #quiser que o texto apareça instantaneamente SOUNDNAME_ON_SPEAK = "" # Definição do nome do arquivo de som . KEY_SHOW_ALL = Input::B # Cancela a leitura de letras. KEY_MESSAGE_SKIP = Input::L # Pular a próxima mensagem. HISKIP_ENABLE_SWITCH_ID = 0 # Definição da Switch que ativará a apresentação instantânea da mensagem. SKIP_BAN_SWITCH_ID = 0 # Definição da Switch que cancela a função das teclas B, L e S FACE_STRETCH_ENABLE = true # Extender o tamanho da face. FACE_WIDTH = 96 # Largura da face. FACE_HEIGHT = 96 # Altura da face. CHARPOP_HEIGHT = 48 end module XRXS9 NAME_WINDOW_TEXT_COLOR = Color.new(192,240,255,255) # Cor da fonte. NAME_WINDOW_TEXT_SIZE = 20 # Tamanho da fonte. NAME_WINDOW_SPACE = 10 # Espaço da janela. NAME_WINDOW_OFFSET_X = 0 # Posição X. NAME_WINDOW_OFFSET_Y = -26 # Posição Y. FOBT_DURATION = 40 # Tempo de fade. end class Window_Message < Window_Selectable LEFT = 0 CENTER = 1 RIGHT = 2 def line_height return DEFAULT_LINE_SPACE end alias xrxs9_initialize initialize def initialize @stand_pictuers = [] @held_windows = [] @extra_windows = [] @extra_sprites = [] xrxs9_initialize @opacity_text_buf = Bitmap.new(32, 32) end alias xrxs9_dispose dispose def dispose @held_windows.each {|window| window.dispose} @held_windows.clear if @gaiji_cache != nil and not @gaiji_cache.disposed? @gaiji_cache.dispose end unless @opacity_text_buf.disposed? @opacity_text_buf.dispose end xrxs9_dispose end alias xrxs9_terminate_message terminate_message def terminate_message @passable = false $game_player.messaging_moving = false if @bgframe_sprite != nil @bgframe_sprite.dispose end if @window_hold @held_windows.push(Window_Copy.new(self)) for window in @extra_windows next if window.disposed? @held_windows.push(Window_Copy.new(window)) end for sprite in @extra_sprites next if sprite.disposed? @held_windows.push(Sprite_Copy.new(sprite)) end self.opacity = 0 self.contents_opacity = 0 @extra_windows.clear @extra_sprites.clear else @held_windows.each {|object| object.dispose} @held_windows.clear end if @name_window_frame != nil @name_window_frame.dispose @name_window_frame = nil end if @name_window_text != nil @name_window_text.dispose @name_window_text = nil end xrxs9_terminate_message end def pop_character=(character_id) @pop_character = character_id end def pop_character return @pop_character end def clear self.contents.clear self.contents.font.color = normal_color self.contents.font.size = DEFAULT_FONT_SIZE self.contents.font.name = DEFAULT_FONT_NAME if DEFAULT_FONT_NAME != "" self.opacity = 255 self.back_opacity = DEFAULT_BACK_OPACITY self.contents_opacity = 255 @mid_stop = false @face_file = nil @current_name = nil @window_hold = false @stand_pictuer_hold = false @passable = false @inforesize = false @x = @y = @indent = @line_index = 0 @cursor_width = @write_speed = @write_wait = @lines_max = 0 @line_widths = [] @line_aligns = [] self.pop_character = nil end def refresh if DEFAULT_BG_PICTURE != "" bitmap = RPG::Cache.picture(DEFAULT_BG_PICTURE) @bgframe_sprite = Sprite.new @bgframe_sprite.x = DEFAULT_BG_X @bgframe_sprite.y = DEFAULT_BG_Y @bgframe_sprite.bitmap = bitmap @bgframe_sprite.z += 5 end self.clear if $game_temp.message_text != nil @now_text = $game_temp.message_text if (/\\_\n/.match(@now_text)) != nil $game_temp.choice_start -= 1 @now_text.gsub!(/\\_\n/) { "" } end if (/\\[Ff]\[(.+?)(\,*?)([0-9]*?)\]/.match(@now_text)) != nil if RPG_FileTest.picture_exist?($1) @face_file = $1 + ".png" @face_index = $3.to_i src = RPG::Cache.picture(@face_file) if $2 == "" @face_index = -1 end if FACE_STRETCH_ENABLE @indent += FACE_WIDTH elsif $2 == "" @indent += src.width else @indent += src.width/4 end end @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" } end @inforesize = (@now_text.gsub!(/\\info/) { "" } != nil) @window_hold = (@now_text.gsub!(/\\hold/) { "" } != nil) @now_text.gsub!(/\\[v]\[([0-9]+)\]/) { $game_variables[$1.to_i].to_s } begin last_text = @now_text.clone @now_text.gsub!(/\\[V]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) } end until @now_text == last_text @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : "" end if @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" } @current_name = $1 end if @now_text.gsub!(/\\[Pp]\[([0-9]+)\]/) { "" } self.pop_character = $1.to_i end if (/\\n/.match(@now_text)) != nil $game_temp.choice_start += 1 @now_text.gsub!(/\\n/) { "\n" } end if @now_text.gsub!(/\\fade/) { "" } @fade_count_before_terminate = XRXS9::FOBT_DURATION end if @now_text.gsub!(/\\pass/) { "" } @passable = true $game_player.messaging_moving = true end nil while( @now_text.sub!(/\n\n\z/) { "\n" } ) @lines_max = @now_text.scan(/\n/).size rxs = [/\\\w\[(\w+)\]/, /\\[.]/, /\\[|]/, /\\[>]/, /\\[<]/, /\\[!]/, /\\[~]/, /\\[i]/, /\\[Oo]\[([0-9]+)\]/, /\\[Hh]\[([0-9]+)\]/, /\\[b]\[([0-9]+)\]/, /\\[Rr]\[(.*?)\]/, /\\[b]/, /\\[i]/] @max_choice_x = 0 lines = @now_text.split(/\n/) for i in 0..@lines_max line = lines[@lines_max - i] next if line == nil line.gsub!(/\\[Ee]\[([0-9]+)\]/) { "\022[#{$1}]" } for rx in rxs line.gsub!(rx) { "" } end @line_aligns[@lines_max - i] = line.sub!(/\\center/) {""} ? CENTER : line.sub!(/\\right/) {""} ? RIGHT : LEFT cx = contents.text_size(line).width @line_widths[@lines_max - i] = cx end choices = @line_widths[$game_temp.choice_start, @line_widths.size] @max_choice_x = choices == nil ? 0 : choices.max + 8 @now_text.gsub!(/\\center/) {""} @now_text.gsub!(/\\right/) {""} @line_aligns[0] = CENTER if @inforesize if self.pop_character != nil and self.pop_character >= 0 max_x = @line_widths.max self.width = max_x + 32 #+ @indent + DEFAULT_FONT_SIZE/2 self.height = [@lines_max * line_height, @indent].max + 32 end @now_text.gsub!(/\\\\/) { "\000" } @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } @now_text.gsub!(/\\[Gg]/) { "\002" } @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" } @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" } @now_text.gsub!(/\\[.]/) { "\005" } @now_text.gsub!(/\\[|]/) { "\006" } @now_text.gsub!(/\\[>]/) { "\016" } @now_text.gsub!(/\\[<]/) { "\017" } @now_text.gsub!(/\\[!]/) { "\020" } @now_text.gsub!(/\\[~]/) { "\021" } @now_text.gsub!(/\\[Ee]\[([0-9]+)\]/) { "\022[#{$1}]" } @now_text.gsub!(/\\[i]/) { "\023" } @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" } @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" } @now_text.gsub!(/\\[b]\[([0-9]+)\]/) { "\026[#{$1}]" } @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "\027[#{$1}]" } @now_text.gsub!(/\\[b]/) { "\031" } @now_text.gsub!(/\\[i]/) { "\032" } reset_window if @current_name != nil self.contents.font.size = XRXS9::NAME_WINDOW_TEXT_SIZE x = self.x + XRXS9::NAME_WINDOW_OFFSET_X y = self.y + XRXS9::NAME_WINDOW_OFFSET_Y w = self.contents.text_size(@current_name).width + 8 + XRXS9::NAME_WINDOW_SPACE h = 26 + XRXS9::NAME_WINDOW_SPACE @name_window_frame = Window_Base.new(x, y, w, h) @name_window_frame.opacity = 160 @name_window_frame.z = self.z + 2 x = self.x + XRXS9::NAME_WINDOW_OFFSET_X + 3 + XRXS9::NAME_WINDOW_SPACE / 2 y = self.y + XRXS9::NAME_WINDOW_OFFSET_Y + 1 + XRXS9::NAME_WINDOW_SPACE / 2 @name_window_text = Air_Text.new(x,y, @current_name, XRXS9::NAME_WINDOW_TEXT_SIZE, XRXS9::NAME_WINDOW_TEXT_COLOR) @name_window_text.z = self.z + 3 self.contents.font.size = DEFAULT_FONT_SIZE @extra_windows.push(@name_window_frame) @extra_windows.push(@name_window_text) end end reset_window self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.font.color = normal_color self.contents.font.name = DEFAULT_FONT_NAME if DEFAULT_FONT_NAME != "" unless @face_file.nil? src = RPG::Cache.picture(@face_file) if @face_index == -1 w = src.width h = src.height x = 0 y = 0 else w = src.width/4 h = src.height/4 x = (@face_index-1) % 4 * w y = (@face_index-1) / 4 * h end if FACE_STRETCH_ENABLE self.contents.stretch_blt(Rect.new(0,0,FACE_WIDTH, FACE_HEIGHT), src, Rect.new(x, y, w, h)) else self.contents.blt(0, 0, src, Rect.new(x, y, w, h)) end end if $game_temp.choice_max > 0 @item_max = $game_temp.choice_max self.active = true self.index = 0 end if $game_temp.num_input_variable_id > 0 digits_max = $game_temp.num_input_digits_max number = $game_variables[$game_temp.num_input_variable_id] @input_number_window = Window_InputNumber.new(digits_max) @input_number_window.number = number @input_number_window.x = self.x + 8 + @indent @input_number_window.y = self.y + $game_temp.num_input_start * 32 end self.contents.font.size = DEFAULT_FONT_SIZE line_reset update unless DEFAULT_TYPING_ENABLE end def line_reset case @line_aligns[@line_index] when LEFT @x = @indent @x += 8 if $game_temp.choice_start <= @line_index when CENTER @x = self.width / 2 - 16 - @line_widths[@line_index].to_i / 2 when RIGHT @x = self.width - 40 - @line_widths[@line_index].to_i end end def update if @passable and not $game_player.messaging_moving self.opacity = 0 terminate_message return end super update_main end def update_main if !self.pop_character.nil? and self.pop_character >= 0 update_reset_window end if skippable_now? and Input.press?(KEY_MESSAGE_SKIP) self.contents_opacity = 255 @fade_in = false elsif @fade_in self.contents_opacity += 24 if @input_number_window != nil @input_number_window.contents_opacity += 24 end if self.contents_opacity == 255 @fade_in = false end return end @now_text = nil if @now_text == "" if @now_text != nil and @mid_stop == false if @write_wait > 0 @write_wait -= 1 return end text_not_skip = DEFAULT_TYPING_ENABLE while true if (c = @now_text.slice!(/./m)) != nil if c == "\000" c = "\\" end if c == "\001" @now_text.sub!(/\[([0-9]+)\]/, "") color = $1.to_i if color >= 0 and color <= 7 self.contents.font.color = text_color(color) if @opacity != nil color = self.contents.font.color self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255) end end c = "" end if c == "\002" if @gold_window == nil @gold_window = Window_Gold.new @gold_window.x = 560 - @gold_window.width if $game_temp.in_battle @gold_window.y = 192 else @gold_window.y = self.y >= 128 ? 32 : 384 end @gold_window.opacity = self.opacity @gold_window.back_opacity = self.back_opacity end c = "" end if c == "\003" @now_text.sub!(/\[([0-9]+)\]/, "") speed = $1.to_i if speed >= 0 and speed <= 19 @write_speed = speed end c = "" end if c == "\005" @write_wait += 5 c = "" end if c == "\006" @write_wait += 20 c = "" end if c == "\016" text_not_skip = false c = "" end if c == "\017" text_not_skip = true c = "" end if c == "\020" @mid_stop = true c = "" end if c == "\021" terminate_message return end if c == "\023" @indent = @x c = "" end if c == "\024" @now_text.sub!(/\[([0-9]+)\]/, "") @opacity = $1.to_i color = self.contents.font.color self.contents.font.color = Color.new(color.red, color.green, color.blue, color.alpha * @opacity / 255) c = "" end if c == "\025" @now_text.sub!(/\[([0-9]+)\]/, "") self.contents.font.size = [[$1.to_i, 6].max, 32].min c = "" end if c == "\026" @now_text.sub!(/\[([0-9]+)\]/, "") @x += $1.to_i c = "" end if c == "\027" process_ruby if SOUNDNAME_ON_SPEAK != "" Audio.se_play("Audio/SE/" + SOUNDNAME_ON_SPEAK) end c = "" end if c == "\030" @now_text.sub!(/\[(.*?)\]/, "") self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24)) if SOUNDNAME_ON_SPEAK != "" Audio.se_play("Audio/SE/" + SOUNDNAME_ON_SPEAK) end @x += 24 c = "" end if c == "\n" @y += 1 @line_index += 1 line_reset if @line_index >= $game_temp.choice_start @cursor_width = @max_choice_x end c = "" end if c == "\022" @now_text.sub!(/\[([0-9]+)\]/, "") @x += draw_gaiji(4 + @x, @y * line_height + (line_height - self.contents.font.size), $1.to_i) if SOUNDNAME_ON_SPEAK != "" then Audio.se_play("Audio/SE/" + SOUNDNAME_ON_SPEAK) end c = "" end if c == "\031" self.contents.font.bold ^= true c = "" end if c == "\032" self.contents.font.italic ^= true c = "" end if c != "" self.contents.draw_text(4+@x, line_height * @y, 40, line_height, c) @x += self.contents.text_size(c).width if SOUNDNAME_ON_SPEAK != "" then Audio.se_play("Audio/SE/" + SOUNDNAME_ON_SPEAK) end end if skippable_now? and (Input.press?(KEY_SHOW_ALL) or Input.press?(KEY_MESSAGE_SKIP)) and (SKIP_BAN_SWITCH_ID == 0 ? true : !$game_switches[SKIP_BAN_SWITCH_ID]) text_not_skip = false end else text_not_skip = true break end break if text_not_skip end @write_wait += @write_speed return end if @input_number_window != nil @input_number_window.update if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $game_variables[$game_temp.num_input_variable_id] = @input_number_window.number $game_map.need_refresh = true @input_number_window.dispose @input_number_window = nil terminate_message end return end if @contents_showing if $game_temp.choice_max == 0 self.pause = true end unless @fade_phase_before_terminate if Input.trigger?(Input::B) if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0 $game_system.se_play($data_system.cancel_se) $game_temp.choice_proc.call($game_temp.choice_canc el_type - 1) terminate_message return end end if Input.trigger?(Input::C) or (skippable_now? and Input.press?(KEY_MESSAGE_SKIP)) if $game_temp.choice_max > 0 $game_system.se_play($data_system.decision_se) $game_temp.choice_proc.call(self.index) end if @mid_stop @mid_stop = false return elsif @fade_count_before_terminate.to_i > 0 @fade_phase_before_terminate = true else terminate_message end end end if @fade_phase_before_terminate @fade_count_before_terminate = 0 if @fade_count_before_terminate == nil @fade_count_before_terminate -= 1 opacity = @fade_count_before_terminate * (256 / XRXS9::FOBT_DURATION) self.contents_opacity = opacity if @fade_count_before_terminate <= 0 @fade_count_before_terminate = 0 @fade_phase_before_terminate = false terminate_message end end return end if @fade_out == false and $game_temp.message_text != nil @contents_showing = true $game_temp.message_window_showing = true refresh Graphics.frame_reset self.visible = true self.contents_opacity = 0 if @input_number_window != nil @input_number_window.contents_opacity = 0 end @fade_in = true return end if self.visible @fade_out = true self.opacity -= 48 if self.opacity == 0 self.visible = false @fade_out = false $game_temp.message_window_showing = false end return end end def reset_window if @inforesize RectalCopy.copy(self, INFO_RECT) elsif self.pop_character != nil and self.pop_character >= 0 update_reset_window else RectalCopy.copy(self, DEFAULT_RECT) case ($game_temp.in_battle ? 0 : $game_system.message_position) when 0 self.y = [16, -XRXS9::NAME_WINDOW_OFFSET_Y + 4].max when 1 self.y = 160 end if DEFAULT_STRETCH_ENABLE and @lines_max >= 4 d = @lines_max * DEFAULT_LINE_SPACE + 32 - self.height if d > 0 self.height += d case $game_system.message_position when 1 self.y -= d/2 when 2 self.y -= d end end end if @face_file != nil self.width += FACE_WIDTH self.x -= FACE_WIDTH/2 end end if $game_system.message_frame == 0 self.back_opacity = DEFAULT_BACK_OPACITY @name_window_frame.back_opacity = DEFAULT_BACK_OPACITY unless @name_window_frame.nil? else self.opacity = 0 @name_window_frame.back_opacity = 0 unless @name_window_frame.nil? end end def update_reset_window if self.pop_character == 0 or $game_map.events[self.pop_character] != nil character = get_character(self.pop_character) x = character.screen_x - self.width / 2 case $game_system.message_position when 0 if @name_window_frame != nil and @name_window_frame.y <= 4 y = 4 - XRXS9::NAME_WINDOW_OFFSET_Y else y = character.screen_y - CHARPOP_HEIGHT - self.height end else y = character.screen_y end self.x = [[x, 4].max, 636 - self.width ].min self.y = [[y, 4].max, 476 - self.height].min if @name_window_frame != nil @name_window_frame.x = self.x + XRXS9::NAME_WINDOW_OFFSET_X @name_window_frame.y = self.y + XRXS9::NAME_WINDOW_OFFSET_Y @name_window_text.x = self.x + XRXS9::NAME_WINDOW_OFFSET_X + 1 + XRXS9::NAME_WINDOW_SPACE/2 - 16 @name_window_text.y = self.y + XRXS9::NAME_WINDOW_OFFSET_Y + 1 + XRXS9::NAME_WINDOW_SPACE/2 - 16 end end end def update_cursor_rect if @index >= 0 n = $game_temp.choice_start + @index self.cursor_rect.set(8 + @indent, n * line_height, @cursor_width, line_height) else self.cursor_rect.empty end end def get_character(parameter) case parameter when 0 return $game_player else events = $game_map.events return events == nil ? nil : events[parameter] end end def skippable_now? return ((SKIP_BAN_SWITCH_ID == 0 ? true : !$game_switches[SKIP_BAN_SWITCH_ID]) and (HISKIP_ENABLE_SWITCH_ID == 0 ? true : $game_switches[HISKIP_ENABLE_SWITCH_ID])) end def visible=(b) @name_window_frame.visible = b unless @name_window_frame.nil? @name_window_text.visible = b unless @name_window_text.nil? @input_number_window.visible = b unless @input_number_window.nil? super end def process_ruby end def draw_gaiji(x, y, num) end def convart_value(option, index) end end class Air_Text < Window_Base def initialize(x, y, designate_text, size, text_color) super(x-16, y-16, 32 + designate_text.size * 12, 56) self.opacity = 0 self.contents = Bitmap.new(self.width - 32, self.height - 32) w = self.contents.width h = self.contents.height self.contents.font.size = size self.contents.font.color = text_color self.contents.draw_text(0, 0, w, h, designate_text) end end class Window_Copy < Window_Base def initialize(window) super(window.x, window.y, window.width, window.height) self.contents = window.contents.dup unless window.contents.nil? self.opacity = window.opacity self.back_opacity = window.back_opacity self.z = window.z end end class Sprite_Copy < Sprite def initialize(sprite) super() self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil? self.opacity = sprite.opacity self.x = sprite.x self.y = sprite.y self.z = sprite.z self.ox = sprite.ox self.oy = sprite.oy end end class Interpreter def command_101 if $game_temp.message_text != nil return false end @message_waiting = true $game_temp.message_proc = Proc.new { @message_waiting = false } $game_temp.message_text = @list[@index].parameters[0] + "\n" line_count = 1 loop do if @list[@index+1].code == 401 $game_temp.message_text += @list[@index+1].parameters[0] + "\n" line_count += 1 else if @list[@index+1].code == 101 if (/\\next\Z/.match($game_temp.message_text)) != nil $game_temp.message_text.gsub!(/\\next/) { "" } $game_temp.message_text += @list[@index+1].parameters[0] + "\n" @index += 1 next end elsif @list[@index+1].code == 102 if @list[@index+1].parameters[0].size <= 4 - line_count @index += 1 $game_temp.choice_start = line_count setup_choices(@list[@index].parameters) end elsif @list[@index+1].code == 103 if line_count < 4 @index += 1 $game_temp.num_input_start = line_count $game_temp.num_input_variable_id = @list[@index].parameters[0] $game_temp.num_input_digits_max = @list[@index].parameters[1] end end return true end @index += 1 end end end class Game_Player < Game_Character attr_accessor :messaging_moving end module RectalCopy def self.copy(rect1, rect2) rect1.x = rect2.x rect1.y = rect2.y rect1.width = rect2.width rect1.height = rect2.height end end #-------------------------------------------------------------------------- class Window_Message < Window_Selectable GAIJI_FILE = "gaiji.png" # Nome do arquivo de imagem. GAIJI_SIZE = 24 # Tamanho de leitura da imagem. end class Interpreter def pretend_stopping=(b) @pretend_stopping = b end alias xrxs9_running? running? def running? return (not @pretend_stopping and xrxs9_running?) end end class Game_Player < Game_Character alias xrxs9_update update def update return xrxs9_update unless @messaging_moving last_showing = $game_temp.message_window_showing $game_system.map_interpreter.pretend_stopping = true $game_temp.message_window_showing = false xrxs9_update $game_temp.message_window_showing = last_showing $game_system.map_interpreter.pretend_stopping = nil end end class Game_Event < Game_Character alias xrxs9_start start def start xrxs9_start if @starting and $game_player.messaging_moving $game_player.messaging_moving = false end end end class Window_Message < Window_Selectable def draw_gaiji(x, y, num) if @gaiji_cache == nil if RPG_FileTest.picture_exist?(GAIJI_FILE) @gaiji_cache = RPG::Cache.picture(GAIJI_FILE) else return 0 end end if @gaiji_cache.width < num * GAIJI_SIZE return 0 end size = GAIJI_SIZE self.contents.stretch_blt(Rect.new(x, y, size, size), @gaiji_cache, Rect.new(num * GAIJI_SIZE, 0, GAIJI_SIZE, GAIJI_SIZE)) if SOUNDNAME_ON_SPEAK != "" then Audio.se_play(SOUNDNAME_ON_SPEAK) end return size end def convart_value(option, index) option == nil ? option = "" : nil option.downcase! case option when "i" unless $data_items[index].name == nil r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name) end when "w" unless $data_weapons[index].name == nil r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name) end when "a" unless $data_armors[index].name == nil r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name) end when "s" unless $data_skills[index].name == nil r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name) end else r = $game_variables[index] end r == nil ? r = "" : nil return r end end class Window_Message < Window_Selectable def process_ruby @now_text.sub!(/\[(.*?)\]/, "") x = @x y = @y * line_height w = 40 h = line_height @x += self.contents.draw_ruby_text(x, y, w, h, $1) end end class Bitmap def draw_ruby_text(x, y, w, h, str) sizeback = self.font.size self.font.size * 3 / 2 > 32 ? rubysize = 32 - self.font.size : rubysize = self.font.size / 2 rubysize = [rubysize, 6].max split_s = str.split(/,/) split_s[0] = "" if split_s[0] == nil split_s[1] = "" if split_s[1] == nil height = sizeback + rubysize width = self.text_size(split_s[0]).width self.font.size = rubysize ruby_width = self.text_size(split_s[1]).width self.font.size = sizeback buf_width = [self.text_size(split_s[0]).width, ruby_width].max width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0 self.font.size = rubysize self.draw_text(x + sub_x, 4 + y - self.font.size, self.text_size(split_s[1]).width, self.font.size, split_s[1]) self.font.size = sizeback self.draw_text(x, y, width, h, split_s[0]) return width end end #------------------------------------------------------------------------------- module XRXS9 BACKLOG_KEY = Input::Y # Definição da tecla da janela de Log BACKLOG_MAX_HEIGHT = 1600 # Altura maxima da janela de log BACKLOG_MAX_INDEX = 12 # Quantidade maxima de frases. end class Window_Message < Window_Selectable alias xrxs9ax_initialize initialize def initialize xrxs9ax_initialize @log_window = Window_MessageLog.new @log_window.z = self.z + 100 end alias xrxs9ax_terminate_message terminate_message def terminate_message @log_window.add_log(@current_name, self.contents) xrxs9ax_terminate_message end alias xrxs9ax_update_main update_main def update_main if Input.trigger?(XRXS9::BACKLOG_KEY) and $game_temp.message_window_showing self.visible = false @log_window.show self.visible = true return end xrxs9ax_update_main end end class Window_MessageLog < Window_Base def initialize super(0,0,640,480) self.visible = false self.back_opacity = 160 self.contents = Bitmap.new(width - 32, XRXS9::BACKLOG_MAX_HEIGHT) self.contents.font.color = XRXS9::NAME_WINDOW_TEXT_COLOR self.contents.font.size = XRXS9::NAME_WINDOW_TEXT_SIZE @names = [] @contetns = [] end def show self.refresh self.visible = true loop do Graphics.update Input.update self.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) self.visible = false break end end end def update super if Input.repeat?(Input::UP) and self.oy >= 32 $game_system.se_play($data_system.cursor_se) self.oy -= 32 return end if Input.repeat?(Input: OWN) and self.oy <= XRXS9::BACKLOG_MAX_HEIGHT - 448$game_system.se_play($data_system.cursor_se) self.oy += 32 return end end def cut_excess(limit_index) for i in limit_index...@contetns.size next if @contetns[i].nil? @contetns[i].dispose @contetns[i] = nil @names[i] = nil end @contetns.compact! @names.compact! end def add_log(name, contents) @names.insert(0, name.to_s) @contetns.insert(0, contents.dup) cut_excess(XRXS9::BACKLOG_MAX_INDEX) end def refresh y = XRXS9::BACKLOG_MAX_HEIGHT index = 0 self.contents.clear loop do contents = @contetns[index] if contents.nil? or y <= 0 break end self.contents.blt(4, y - contents.height, contents, contents.rect) y -= contents.height self.contents.draw_text(4, y-24, 600, 24, @names[index].to_s) y -= 32 index += 1 end cut_excess(index) self.oy = XRXS9::BACKLOG_MAX_HEIGHT - 416 end def dispose for contents in @contetns next if contents.nil? contents.dispose end super end end #------------------------------------------------------------------------------ module XRXS9C SWITCH_ID = 8 #Definição da Switch que ativa a mensagem cinematografica. RECT = Rect.new(0,400,640,96)#X,Y,H,L,D da janela de mensagem cine. end class Window_Message < Window_Selectable alias xrxs9c_reset_window reset_window def reset_window if $game_switches[XRXS9C::SWITCH_ID] RectalCopy.copy(self, XRXS9C::RECT) self.opacity = 0 @line_aligns[0] = CENTER @line_aligns[1] = CENTER return end xrxs9c_reset_window end end class Scene_Map alias xrxs9c_main main def main black = Color.new(0,0,0,255) @cinemasks = [] mask = Sprite.new mask.bitmap = Bitmap.new(640,48) mask.bitmap.fill_rect(0,0,640,48, black) mask.x = 0 mask.y = -48 mask.z = 5001 @cinemasks[0] = mask mask = Sprite.new mask.bitmap = Bitmap.new(640,72) mask.bitmap.fill_rect(0,0,640,72, black) mask.x = 0 mask.y = 480 mask.z = 5001 @cinemasks[1] = mask mask = Sprite.new mask.bitmap = Bitmap.new(640,480) mask.bitmap.fill_rect(0,0,640,480, black) mask.x = 0 mask.y = 0 mask.z = 199 mask.opacity = 0 @cinemasks[2] = mask @cinema_fadecount = 24 xrxs9c_main @cinemasks.each{|sprite| sprite.dispose } end alias xrxs9c_update update def update update_cinema xrxs9c_update end def update_cinema if ( $game_switches[XRXS9C::SWITCH_ID] and @cinema_fadecount > 0) or (not $game_switches[XRXS9C::SWITCH_ID] and @cinema_fadecount < 24) @cinema_fadecount += ($game_switches[XRXS9C::SWITCH_ID] ? -1 : 1) @cinemasks[0].y = 0 - 6 * @cinema_fadecount / 3 @cinemasks[1].y = 480 - 9 * (24 - @cinema_fadecount) / 3 @cinemasks[2].opacity = 4 * (24 - @cinema_fadecount) end end end #------------------------------------------------------------------------------- class Window_Message < Window_Selectable def pop_character=(character_id) @pop_character = character_id $mes_id = character_id end end Solo páguenlo encima de Main y ya está. Pronto más. |
|
|
||||
|
||||
|
Aportes de Scripts RPG-Maker
|
|
||||
|
Subir de nivel al estilo final fántasy:
Spoiler
Script Subir Nivel al Estilo Final Fantasy Pasos para subir nivel al estilo Final Fantasy 1.Lee con mucha atención los textos en rojo de este documento, el resto es solo copiar y pegar 2. Entra a la ventana de Scripts 3. Ve a la ventana Game_Actor y sustituye todo lo que hay por esto: #================================================= ============================= # ■ Game_Actor #------------------------------------------------------------------------------ # Esta clase trata los personajes. #================================================= ============================= class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # - Creamos las variables... #-------------------------------------------------------------------------- attr_reader :name # Nombre attr_reader :character_name # Nombre del personaje attr_reader :character_hue # Color del personaje attr_reader :class_id # ID de profesion attr_reader :weapon_id # ID de arma attr_reader :armor1_id # ID de escudo attr_reader :armor2_id # ID de casco attr_reader :armor3_id # ID de armadura attr_reader :armor4_id # ID de accesiorios attr_reader :level # Nivel attr_reader :exp # Experiencia (EXP) attr_reader :skills # Habilidades #-------------------------------------------------------------------------- # - Inicio de Objetos... # actor_id : ID del Personaje #-------------------------------------------------------------------------- def initialize(actor_id) super() setup(actor_id) end #-------------------------------------------------------------------------- # - Opciones # actor_id : ID del Personaje #-------------------------------------------------------------------------- def setup(actor_id) actor = $data_actors[actor_id] @actor_id = actor_id @name = actor.name @character_name = actor.character_name @character_hue = actor.character_hue @battler_name = actor.battler_name @battler_hue = actor.battler_hue @class_id = actor.class_id @weapon_id = actor.weapon_id @armor1_id = actor.armor1_id @armor2_id = actor.armor2_id @armor3_id = actor.armor3_id @armor4_id = actor.armor4_id @level = actor.initial_level @exp_list = Array.new(101) make_exp_list @exp = @exp_list[@level] @skills = [] @hp = maxhp @sp = maxsp @states = [] @states_turn = {} @maxhp_plus = 0 @maxsp_plus = 0 @str_plus = 0 @dex_plus = 0 @agi_plus = 0 @int_plus = 0 # Uso de habilidades for i in 1..@level for j in $data_classes[@class_id].learnings if j.level == i learn_skill(j.skill_id) end end end # Actualizar estado auto. update_auto_state(nil, $data_armors[@armor1_id]) update_auto_state(nil, $data_armors[@armor2_id]) update_auto_state(nil, $data_armors[@armor3_id]) update_auto_state(nil, $data_armors[@armor4_id]) end #-------------------------------------------------------------------------- # - Uso de ID de Personaje #-------------------------------------------------------------------------- def id return @actor_id end #-------------------------------------------------------------------------- # - Uso de Indice #-------------------------------------------------------------------------- def index return $game_party.actors.index(self) end #-------------------------------------------------------------------------- # - Calculo de EXP #-------------------------------------------------------------------------- def make_exp_list actor = $data_actors[@actor_id] @exp_list[1] = 0 pow_i = 2.4 + actor.exp_inflation / 100.0 for i in 2..100 if i > actor.final_level @exp_list[i] = 0 else n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i) @exp_list[i] = @exp_list[i-1] + Integer(n) end end end #-------------------------------------------------------------------------- # - Uso del valor compensado del atributo # element_id : ID de elemento #-------------------------------------------------------------------------- def element_rate(element_id) # Uso del valor numerico que correspondiente al grado de atributo table = [0,200,150,100,50,0,-100] result = table[$data_classes[@class_id].element_ranks[element_id]] # Partir en 2 cuando se defiende con el protector for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id] armor = $data_armors[i] if armor != nil and armor.guard_element_set.include?(element_id) result /= 2 end end # Partir en 2 cuando se defiende con el estado for i in @states if $data_states[i].guard_element_set.include?(element_id) result /= 2 end end # Fin del Metodo return result end #-------------------------------------------------------------------------- # - Uso del grado de estado #-------------------------------------------------------------------------- def state_ranks return $data_classes[@class_id].state_ranks end #-------------------------------------------------------------------------- # - Juicio de estado de defensa # state_id : ID de estado #-------------------------------------------------------------------------- def state_guard?(state_id) for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id] armor = $data_armors[i] if armor != nil if armor.guard_state_set.include?(state_id) return true end end end return false end #-------------------------------------------------------------------------- # - Uso del atributo de un ataque normal #-------------------------------------------------------------------------- def element_set weapon = $data_weapons[@weapon_id] return weapon != nil ? weapon.element_set : [] end #-------------------------------------------------------------------------- # - Uso del cambio de estado de un ataque normal (+) #-------------------------------------------------------------------------- def plus_state_set weapon = $data_weapons[@weapon_id] return weapon != nil ? weapon.plus_state_set : [] end #-------------------------------------------------------------------------- # - Uso del cambio de estado de un ataque normal (-) #-------------------------------------------------------------------------- def minus_state_set weapon = $data_weapons[@weapon_id] return weapon != nil ? weapon.minus_state_set : [] end #-------------------------------------------------------------------------- # - Uso de MaxPV #-------------------------------------------------------------------------- def maxhp n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min for i in @states n *= $data_states[i].maxhp_rate / 100.0 end n = [[Integer(n), 1].max, 9999].min return n end #-------------------------------------------------------------------------- # - Uso basico de MaxPV #-------------------------------------------------------------------------- def base_maxhp return $data_actors[@actor_id].parameters[0, @level] end #-------------------------------------------------------------------------- # - Uso basico de MaxPM #-------------------------------------------------------------------------- def base_maxsp return $data_actors[@actor_id].parameters[1, @level] end #-------------------------------------------------------------------------- # - Uso basico de Fuerza Fisica #-------------------------------------------------------------------------- def base_str n = $data_actors[@actor_id].parameters[2, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] n += weapon != nil ? weapon.str_plus : 0 n += armor1 != nil ? armor1.str_plus : 0 n += armor2 != nil ? armor2.str_plus : 0 n += armor3 != nil ? armor3.str_plus : 0 n += armor4 != nil ? armor4.str_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # - Uso basico de Destreza #-------------------------------------------------------------------------- def base_dex n = $data_actors[@actor_id].parameters[3, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] n += weapon != nil ? weapon.dex_plus : 0 n += armor1 != nil ? armor1.dex_plus : 0 n += armor2 != nil ? armor2.dex_plus : 0 |












