rpg 만들기에는 제어문자라는것이 있다.
예를 들면 글자색 바꾸기라든가 주인공 이름 표시등의 기능을 하는 제어문자가 있는데.
이 제어문자를 조금 추가한 스크립트이다.
아래 스크립트를 main 섹션 위쪽에 붙여넣자
#============================================================================== # [VX] NMS - Neo Message System by Woratana #------------------------------------------------------------------------------ # Version: 1.0 # Released on: 03/02/2008 # by Woratana [woratana@hotmail.com] # # Special Thanks: AMS R4 - Dubealex # =begin +[Features Version 1.0]+ \map - Show Map Name \nc[actor id from database] - Show Class of Actor \np[1 to 4 (member order in party)] - Show Name of Actor who is in that order \nm[monster] - Show Name of Monster \nt[troop id] - Show Name of Troop \ni[item id] - Show Name of Item \price[item id] - Show Price of Item \nw[weapon id] - Show Name of Weapon \na[armor -id] - Show Name of Armor \font[font name] - Change Font to "font name" (case sensitive font's name) \size[font size] - Change Font Size to "font size" (number) \ref = Reset font to Default Font Name \res = Reset Font Size to Default Font Size =end #============================================================================== module NMS #=========================== # SETUP NMS FEATURES HERE! #========================= FONT_NAME = "Arial" # Default Font Name FONT_SIZE = 20 # Default Font Size end class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ? ?? #-------------------------------------------------------------------------- MAX_LINE = 4 # ???? #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def initialize super(0, 288, 544, 128) self.z = 200 self.active = false self.index = -1 self.openness = 0 @opening = false # ?????????????? @closing = false # ?????????????? @text = nil # ?????????? @contents_x = 0 # ????????? X ?? @contents_y = 0 # ????????? Y ?? @line_count = 0 # ??????????? @wait_count = 0 # ???????? @background = 0 # ????? @position = 2 # ???? @show_fast = false # ?????? @line_show_fast = false # ????????? @pause_skip = false # ????????? # NMS $game_message.nms_fontname = NMS::FONT_NAME if $game_message.nms_fontname == nil $game_message.nms_fontsize = NMS::FONT_SIZE if $game_message.nms_fontsize == nil @nms = $game_message create_gold_window create_number_input_window create_back_sprite end #-------------------------------------------------------------------------- # ? ?? #-------------------------------------------------------------------------- def dispose super dispose_gold_window dispose_number_input_window dispose_back_sprite end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def update super update_gold_window update_number_input_window update_back_sprite update_show_fast unless @opening or @closing # ??????????? if @wait_count > 0 # ???????? @wait_count -= 1 elsif self.pause # ??????? input_pause elsif self.active # ?????? input_choice elsif @number_input_window.visible # ????? input_number elsif @text != nil # ???????? update_message # ???????? elsif continue? # ????? start_message # ???????? open # ???????? $game_message.visible = true else # ?????? close # ????????? $game_message.visible = @closing end end end #-------------------------------------------------------------------------- # ? ??????????? #-------------------------------------------------------------------------- def create_gold_window @gold_window = Window_Gold.new(384, 0) @gold_window.openness = 0 end #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- def create_number_input_window @number_input_window = Window_NumberInput.new @number_input_window.visible = false end #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- def create_back_sprite @back_sprite = Sprite.new @back_sprite.bitmap = Cache.system("MessageBack") @back_sprite.visible = (@background == 1) @back_sprite.z = 190 end #-------------------------------------------------------------------------- # ? ??????????? #-------------------------------------------------------------------------- def dispose_gold_window @gold_window.dispose end #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- def dispose_number_input_window @number_input_window.dispose end #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- def dispose_back_sprite @back_sprite.dispose end #-------------------------------------------------------------------------- # ? ??????????? #-------------------------------------------------------------------------- def update_gold_window @gold_window.update end #-------------------------------------------------------------------------- # ? ???????????? #-------------------------------------------------------------------------- def update_number_input_window @number_input_window.update end #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- def update_back_sprite @back_sprite.visible = (@background == 1) @back_sprite.y = y - 16 @back_sprite.opacity = openness @back_sprite.update end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def update_show_fast if self.pause or self.openness < 255 @show_fast = false elsif Input.trigger?(Input::C) and @wait_count < 2 @show_fast = true elsif not Input.press?(Input::C) @show_fast = false end if @show_fast and @wait_count > 0 @wait_count -= 1 end end #-------------------------------------------------------------------------- # ? ???????????????????? #-------------------------------------------------------------------------- def continue? return true if $game_message.num_input_variable_id > 0 return false if $game_message.texts.empty? if self.openness > 0 and not $game_temp.in_battle return false if @background != $game_message.background return false if @position != $game_message.position end return true end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def start_message @text = "" for i in 0...$game_message.texts.size @text += " " if i >= $game_message.choice_start @text += $game_message.texts[i].clone + "\x00" end @item_max = $game_message.choice_max convert_special_characters reset_window new_page end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def new_page contents.clear if $game_message.face_name.empty? @contents_x = 0 else name = $game_message.face_name index = $game_message.face_index draw_face(name, index, 0, 0) @contents_x = 112 end @contents_y = 0 @line_count = 0 @show_fast = false @line_show_fast = false @pause_skip = false contents.font.color = text_color(0) end #-------------------------------------------------------------------------- # ? ???? #-------------------------------------------------------------------------- def new_line if $game_message.face_name.empty? @contents_x = 0 else @contents_x = 112 end @contents_y += WLH @line_count += 1 @line_show_fast = false end #-------------------------------------------------------------------------- # Convert Special Character #-------------------------------------------------------------------------- def convert_special_characters # Woratana's Map Name @text.gsub!(/\\[Mm]ap/) { nms_get_map_name } # Woratana's Actor Class Name @text.gsub!(/\\[Nn][Cc]\[([0-9]+)\]/i) { $data_classes[$data_actors[$1.to_i].class_id].name } # Woratana's Party Actor Name @text.gsub!(/\\[Nn][Pp]\[([0-9]+)\]/i) { $game_party.members[($1.to_i - 1)].name } # Woratana's Monster Name @text.gsub!(/\\[Nn][Mm]\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name } # Woratana's Troop Name @text.gsub!(/\\[Nn][Tt]\[([0-9]+)\]/i) { $data_troops[$1.to_i].name } # Woratana's Item Name @text.gsub!(/\\[Nn][Ii]\[([0-9]+)\]/i) { $data_items[$1.to_i].name } # Woratana's Item Price @text.gsub!(/\\[Pp]rice\[([0-9]+)\]/i) { $data_items[$1.to_i].price } # Woratana's Weapon Name @text.gsub!(/\\[Nn][Ww]\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name } # Woratana's Armor Name @text.gsub!(/\\[Nn][Aa]\[([0-9]+)\]/i) { $data_armors[$1.to_i].name } # Woratana's Font Name Change @text.gsub!(/\\[Ff]ont\[(.*?)\]/) do @nms.nms_fontname = $1.to_s @text.sub!(/\\[Ff]ont\[(.*?)\]/) { "" } end # Woratana's Font Size Change @text.gsub!(/\\[Ss]ize\[(.*?)\]/) do @nms.nms_fontsize = $1.to_i @text.sub!(/\\[Ss]ize\[(.*?)\]/) { "" } end # Woratana's Reset Font Size @text.gsub!(/\\[Rr]ef/) do @nms.nms_fontname = NMS::FONT_NAME @text.sub!(/\\[Rr]ef\[(.*?)\]/) { "" } end # Woratana's Reset Font Size @text.gsub!(/\\[Rr]es/) do @nms.nms_fontsize = NMS::FONT_SIZE @text.sub!(/\\[Rr]es\[(.*?)\]/) { "" } end @text.gsub!(/\\[Vv]\[([0-9]+)\]/i) { $game_variables[$1.to_i] } @text.gsub!(/\\[Nn]\[([0-9]+)\]/i) { $game_actors[$1.to_i].name } @text.gsub!(/\\[Cc]\[([0-9]+)\]/i) { "\x01[#{$1}]" } @text.gsub!(/\\[Gg]/) { "\x02" } @text.gsub!(/\\\./) { "\x03" } @text.gsub!(/\\\|/) { "\x04" } @text.gsub!(/\\!/) { "\x05" } @text.gsub!(/\\>/) { "\x06" } @text.gsub!(/\\</) { "\x07" } @text.gsub!(/\\\^/) { "\x08" } @text.gsub!(/\\\\/) { "\\" } end #-------------------------------------------------------------------------- # ? ?????????????? #-------------------------------------------------------------------------- def reset_window @background = $game_message.background @position = $game_message.position if @background == 0 # ??????? self.opacity = 255 else # ????????????? self.opacity = 0 end case @position when 0 # ? self.y = 0 @gold_window.y = 360 when 1 # ? self.y = 144 @gold_window.y = 0 when 2 # ? self.y = 288 @gold_window.y = 0 end end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def terminate_message self.active = false self.pause = false self.index = -1 @gold_window.close @number_input_window.active = false @number_input_window.visible = false $game_message.main_proc.call if $game_message.main_proc != nil $game_message.clear end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def update_message loop do c = @text.slice!(/./m) # ??????? case c when nil # ?????????? finish_message # ???? break when "\x00" # ?? new_line if @line_count >= MAX_LINE # ???????? unless @text.empty? # ?????????? self.pause = true # ???????? break end end when "\x01" # \C[n] (?????) @text.sub!(/\[([0-9]+)\]/, "") contents.font.color = text_color($1.to_i) next when "\x02" # \G (?????) @gold_window.refresh @gold_window.open when "\x03" # \. (???? 1/4 ?) @wait_count = 15 break when "\x04" # \| (???? 1 ?) @wait_count = 60 break when "\x05" # \! (????) self.pause = true break when "\x06" # \> (???? ON) @line_show_fast = true when "\x07" # \< (???? OFF) @line_show_fast = false when "\x08" # \^ (??????) @pause_skip = true else # ????? self.contents.font.name = @nms.nms_fontname self.contents.font.size = @nms.nms_fontsize contents.draw_text(@contents_x, @contents_y, 40, WLH, c) c_width = contents.text_size(c).width @contents_x += c_width end break unless @show_fast or @line_show_fast end end #-------------------------------------------------------------------------- # ? ?????????? #-------------------------------------------------------------------------- def finish_message if $game_message.choice_max > 0 start_choice elsif $game_message.num_input_variable_id > 0 start_number_input elsif @pause_skip terminate_message else self.pause = true end @wait_count = 10 @text = nil end #-------------------------------------------------------------------------- # ? ?????? #-------------------------------------------------------------------------- def start_choice self.active = true self.index = 0 end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def start_number_input digits_max = $game_message.num_input_digits_max number = $game_variables[$game_message.num_input_variable_id] @number_input_window.digits_max = digits_max @number_input_window.number = number if $game_message.face_name.empty? @number_input_window.x = x else @number_input_window.x = x + 112 end @number_input_window.y = y + @contents_y @number_input_window.active = true @number_input_window.visible = true @number_input_window.update end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def update_cursor if @index >= 0 x = $game_message.face_name.empty? ? 0 : 112 y = ($game_message.choice_start + @index) * WLH self.cursor_rect.set(x, y, contents.width - x, WLH) else self.cursor_rect.empty end end #-------------------------------------------------------------------------- # ? ????????? #-------------------------------------------------------------------------- def input_pause if Input.trigger?(Input::B) or Input.trigger?(Input::C) self.pause = false if @text != nil and not @text.empty? new_page if @line_count >= MAX_LINE else terminate_message end end end #-------------------------------------------------------------------------- # ? ???????? #-------------------------------------------------------------------------- def input_choice if Input.trigger?(Input::B) if $game_message.choice_cancel_type > 0 Sound.play_cancel $game_message.choice_proc.call($game_message.choice_cancel_type - 1) terminate_message end elsif Input.trigger?(Input::C) Sound.play_decision $game_message.choice_proc.call(self.index) terminate_message end end #-------------------------------------------------------------------------- # ? ??????? #-------------------------------------------------------------------------- def input_number if Input.trigger?(Input::C) Sound.play_decision $game_variables[$game_message.num_input_variable_id] = @number_input_window.number $game_map.need_refresh = true terminate_message end end def nms_get_map_name mapdata = load_data("Data/MapInfos.rvdata") map_id = $game_map.map_id return mapdata[map_id].name end end # Class End #============================================================================== # Game_Message #------------------------------------------------------------------------------ # Store NMS Variables #============================================================================== class Game_Message attr_accessor :nms_fontname, :nms_fontsize end
제어문자 설며은 아래 ^^
\map - Show Map Name
\nc[actor id from database] - Show Class of Actor
\np[1 to 4 (member order in party)] - Show Name of Actor who is in that order
\nm[monster] - Show Name of Monster
\nt[troop id] - Show Name of Troop
\ni[item id] - Show Name of Item
\price[item id] - Show Price of Item
\nw[weapon id] - Show Name of Weapon
\na[armor -id] - Show Name of Armor
\font[font name] - Change Font to "font name" (case sensitive font's name)
\size[font size] - Change Font Size to "font size" (number)
\ref = Reset font to Default Font Name
\res = Reset Font Size to Default Font Size
반응형
'게임이야기. > RPG 만들기 VX' 카테고리의 다른 글
점프 관련 버그 수정 ^^ (0) | 2008.02.16 |
---|---|
RPG vx 이동 속도 조절 할수있는 스크립트 (1) | 2008.02.12 |
RPG VX 랜덤 타이틀 그래픽 스크립트 (0) | 2008.02.12 |
rpg vx 가벼운 메뉴 스크립트 (0) | 2008.02.05 |
rpg vx 상태 메뉴 변경 스크립트 (3) | 2008.02.05 |
Skip Title Script (0) | 2008.02.01 |
vx 맵 배치 강좌 [외국 사이트에서 퍼온 ㅎㅎ] (0) | 2008.02.01 |