Advertisement
mylafter

Woratana - NMS Script

Jan 25th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.63 KB | None | 0 0
  1. #===============================================================
  2. # + [VX] [ NMS - Neo Message System 3.0 Beta ] +
  3. #--------------------------------------------------------------
  4. # >> by Woratana [woratana@hotmail.com]
  5. # >> Thaiware RPG Maker Community
  6. # >> Special Thanks: Mako, Yatzumo, Straycat, Erzengel, RPG,
  7. # Dubalex, Modern Algebra, Equilibrium Keeper
  8. #--------------------------------------------------------------
  9. # Released on: 07/06/2008 (D-M-Y)
  10. #--------------------------------------------------------------
  11. # Include: NEO-FACE SYSTEM ADVANCE (Version 3.0) by Woratana
  12. #===============================================================
  13. # Note:
  14. # - This script started when VX English is not coming out yet,
  15. # so some of comments here are still be Japanese :)
  16. # - This script is included newest version of Neo-Face System,
  17. # so you have to remove old Neo-Face System if you have it.
  18.  
  19. =begin
  20. =============================================
  21. + NMS 3 Beta + [07/06/2008]
  22. - Add 'Text Remove List'
  23. - Change window size & position temporarily
  24. - You can now call script:
  25. $game_message.create_nms_data
  26. to reset NMS data or create NMS data for old save file
  27. - Fixed bug for write actor's class name
  28. - Fixed bug for out-of-screen name box
  29. - Add NAMEBOX_Y_PLUS_TOP to fix out-of-screen name box when show message on Top
  30. - Set name box's opacity for different types of message background
  31. - Auto fix if message window is out of screen
  32. - You can draw new face while message is running, and also set new face size
  33. =============================================
  34. =============================================
  35. + NMS 2.3 + [11/03/2008 - 06/04/2008]
  36. - Remove Color for [WRITE TEXT] features
  37. - 'Quick Text' feature
  38. - Animated Face
  39. - Play SE/ME
  40. - Typing Sound
  41. - Scroll Text Vertically and Horizontally
  42. - Auto-cut text (Not work perfectly)
  43. - Hex Color (Special Thanks: RPG & Erzengel)
  44. - Pop Message (Work in Progress)
  45. - Add the script code in comment of some settings,
  46. so user can change it in game by call script.
  47. =============================================
  48. =============================================
  49. + NMS 2.1 + [11/03/2008]: Fixed Name Box Bug
  50. =============================================
  51. =====================================
  52. + NMS 2.0 FEATURES LIST +
  53. =====================================
  54. Use these features in message box
  55. ----------------------------------
  56. >> NMS MESSAGE FEATURES
  57. ----------------------------------
  58. --------------------------
  59. >> [SPECIAL CALL] PART
  60. --------------------------
  61. \ce[Common Event ID] << Run Common Event immediately
  62.  
  63. \ani[Animation ID] << Show Animation on 'This Event'
  64. \bal[Balloon ID] << Show Ballon on 'This Event'
  65.  
  66. * Note: This Event = Event that show this message
  67.  
  68. --------------------------
  69. >> [MESSAGE WINDOW] PART
  70. --------------------------
  71. * temporary properties will be using only one time
  72. \wx[x] << Set temporary X to x
  73. \wy[y] << Set temporary Y to y
  74. \ww[width] << Set temporary Width to width
  75. \wh[height] << Set temporary Height to height
  76.  
  77. ----------------------------------------
  78. >> +[ POP TEXT ]+
  79. ----------------------------------------
  80. Pop text is the message box that will show over character
  81. and has size equal to message size
  82.  
  83. You can call pop text by put this in message
  84. \p[character]
  85.  
  86. * character: Character you want to show message box over~
  87. 0 for Player
  88. -1 for This Event
  89. 1 or more for that event ID
  90.  
  91. ----------------------------------------
  92. >> +[ QUICK TEXT ]+ a.k.a. Shortcut
  93. ----------------------------------------
  94. Add & Call your very long text (or) text that you use many times by shortcut.
  95. You can put special syntax in it, e.g. 'Welcome to \c[10]Syria Village\c[0]
  96.  
  97. $nms.qt[Quick Text ID] = 'Text you want' << Add Quick Text
  98.  
  99. \qt[Quick Text ID] << Call Quick Text from message box
  100.  
  101. --------------------------
  102. >> [DRAW IMAGE] PART
  103. --------------------------
  104. \dw[weapon ID] << Draw Weapon Icon + Weapon Name
  105. \da[armor ID] << Draw Armor Icon + Armor Name
  106. \di[item ID] << Draw Item Icon + Item Name
  107. \ds[skill ID] << Draw Skill Icon + Skill Name
  108.  
  109. \ic[icon ID] << Draw Icon
  110.  
  111. \dp[image_name] << Draw Image from folder 'System'
  112.  
  113. --------------------------
  114. >> [WRITE TEXT] PART
  115. --------------------------
  116. \map << Write Map Name
  117.  
  118. \nc[actor ID] << Write Class of Actor
  119. \np[1 to 4 (order in party)] << Write Name of actor in that order
  120. \nm[monster ID] << Write Monster Name
  121. \nt[troop ID] << Write Troop Name
  122.  
  123. \nw[weapon ID] << Write Weapon Name
  124. \na[armor ID] << Write Armor Name
  125. \ns[skill ID] << Write Skill Name
  126. \ni[item ID] << Write Item Name
  127. \price[item ID] << Write Item Price
  128.  
  129. --------------------------
  130. >> [TEXT EFFECT] PART
  131. --------------------------
  132. \fn[Font Name] (or) << Change Font Name
  133. \fs[Font Size] << Change Font Size
  134. \delay[Delay] << Change text Delay per letter (in frame, 60 frames = about 1 sec)
  135.  
  136. \ref << Reset Font Name
  137. \res << Reset Font Size
  138. \red << Reset text Delay
  139.  
  140. \b << Turn on/off BOLD text
  141. \i << Turn on/off ITALIC text
  142. \sh << Turn on/off SHADOW text
  143. \lbl << Turn on/off LETTER-BY-LETTER Mode (default is ON)
  144.  
  145. --------------------------
  146. >> [NAME BOX & FACE] PART
  147. --------------------------
  148. \nb[Name] << Show Name Box in current message window
  149.  
  150. \rnb[Name] (or) $nms._name = 'Name' << Repeat Name Box:
  151. Name Box with this name will show again and again in next messages
  152. unless there is \nb[Name] in that message, or you've stop this option by type \rnb[]
  153.  
  154. \sd[side] (or) $nms.side = side << Change Face Side:
  155. (0: Left Side Normal Face | -1: Right Side Normal Face)
  156. (1: Left Side Neo Face | 2: Right Side Neo Face)
  157.  
  158. $nms.color = [Red,Green,Blue] << Change Name Text Color:
  159. Put RGB Color in, e.g. [255,100,200]
  160.  
  161. \fa[face_file_name, face_index] (or) \fa[face_file_name, face_index, new_side]
  162. << Draw new face while message is running~
  163. face_file_name: Face image's name
  164. face_index: Index of the face in image (0 - 7)
  165. new_side: Face side you want to change to
  166.  
  167. --------------------------
  168. >> [SOUND] PART
  169. --------------------------
  170. \se[filename] << Play SE
  171. \me[filename] << Play ME
  172. \bgm[filename] << Play BGM
  173.  
  174. \typ << Turn on/off typing sound
  175.  
  176. --------------------------
  177. >> [Misc.] PART
  178. --------------------------
  179. \cb << Turn on/off cancel skip text feature (Player can/can't press [Enter] to skip text)
  180. \nl << Start new line
  181. \sc[x] << Create blank space x pixel
  182. \w[x] << Wait x frames
  183. \c[#XXXXXX] << Use Hex Color for text
  184.  
  185. ----------------------------------
  186. >> VX DEFAULT MESSAGE FEATURES
  187. ----------------------------------
  188. \v[variable ID] << Write value from variable
  189. \n[actor ID] << Write actor's name
  190. \c[color ID] << Change text color (Color ID is from Down-right corner in Windowskin)
  191. \g << Show gold window
  192. \. << Wait 15 frames (about 1/4 sec)
  193. \| << Wait 60 frames (about 1 sec)
  194. \! << Wait for player to press button to continue message
  195. \> << Skip letter-by-letter in current line
  196. \< << Stop 'skip letter-by-letter' in current line
  197. \^ << Close message box immediately
  198. \\ << Write '\'
  199.  
  200. =end
  201. class Window_Base
  202.  
  203. #---------------------------------
  204. # [START] SETUP SCRIPT PART
  205. #-------------------------------
  206. #---------------------------------
  207. # ? MESSAGE SYSTEM
  208. #-------------------------------
  209. NMS_FONT_NAME = Font.default_name # Default Font Name
  210. NMS_FONT_SIZE = 20 # Default Font Size
  211.  
  212. # COLOR_ID is from Windowskin image in down-right corder
  213. NMS_ITEM_NAME_COLOR_ID = 5
  214. NMS_WEAPON_NAME_COLOR_ID = 10
  215. NMS_ARMOR_NAME_COLOR_ID = 4
  216. NMS_SKILL_NAME_COLOR_ID = 2
  217.  
  218. NMS_DELAY_PER_LETTER = 0 # Delay between letter when showing text letter-by-letter
  219. # Delay is in frame, 60 frames = 1 second
  220. # $nms.text_delay = (number)
  221.  
  222. TEXT_X_PLUS = 0 # Move Text Horizontally
  223. CHOICE_INPUT_X_PLUS = 0
  224. # Move Choices Text and Input Number Text Horizontally
  225.  
  226. # [NEW SETTING] #
  227. NMS_MSGWIN_X = 0 # Default Message Window X
  228. # $nms.msg_x = (number)
  229.  
  230. NMS_MSGWIN_WIDTH = 544 # Default Message Window Width
  231. # $nms.msg_w = (number)
  232. NMS_MSGWIN_MIN_HEIGHT = 128 # Default & Minimum Message Window Height
  233. # $nms.msg_h_user = (number)
  234.  
  235. NMS_MAX_LINE = 4 # Max Message Lines to display per page
  236. # $nms.max_line = (number)
  237. NMS_GET_NEXT_LINE = false # Get messages from next message command, if box is not full
  238. # $nms.next_msg = true/false
  239.  
  240. NMS_MSG_BACK = "MessageBack" # Message Back Image File Name (For 'Dim Background' Message)
  241. # (Must be in folder 'System')
  242. # $nms.mback = 'Image Name'
  243. NMS_MSG_BACK_OPACITY = 255 # message Back's Opacity
  244. # $nms.mback_opac = (0 - 255)
  245.  
  246. NMS_TEXT_SCROLL = false # Use Vertical Text Scroll?
  247. # $nms.txt_scrl = true/false
  248.  
  249. NMS_TEXT_AUTO_CUT = false # Text will automatically start new line if that line is full
  250. # (Some bug, it may cut in the middle of word..)
  251. # $nms.txt_cut = true/false
  252.  
  253. NMS_TEXT_AUTO_SCROLL_HORIZONTAL = false # Text will automatically scroll to the left if line is full
  254. # This will not work if NMS_TEXT_AUTO_CUT is true
  255. # $nms.txt_scrl_hori = true/false
  256. NMS_TEXT_AUTO_SCROLL_HORIZONTAL_DELAY = 1 # Scroll Delay (in frame)
  257. # $nms.txt_scrl_hori_delay = (number)
  258.  
  259. NMS_USER_NEW_LINE = false # Text will goes in new line ONLY when type \nl
  260. # (Good for Text Auto Cut)
  261. # $nms.txt_unl = true/false
  262.  
  263. NMS_REMOVE_LIST = [] # List of text that you want to remove from message
  264. # for example, NMS_REMOVE_LIST = ['test', '[MS]']
  265. # will remove text 'test' and '[MS]' before show message
  266. # Note that this is NOT case sensitive
  267.  
  268. #---------------------------------
  269. # ? FACE SYSTEM
  270. #-------------------------------
  271. #------------------------------------------------
  272. # ** BOTH FACE SYSTEMS SETUP
  273. #----------------------------------------------
  274. DEFAULT_FACE_SIDE = 1 # Default Face Side when game start~
  275. # (0: Left Side Normal Face | -1: Right Side Normal Face)
  276. # (1: Left Side Neo Face | 2: Right Side Neo Face)
  277. # $nms.side = (side no.)
  278.  
  279. FACE_X_PLUS = 0 # Move Face Horizontally (Left: -, Right: +)
  280. FACE_Y_PLUS = 0 # Move Face Vertically (Up: -, Down: +)
  281.  
  282. MOVE_TEXT = true # (true/false)
  283. # Move text to right side of face, when showing face in left side.
  284.  
  285. #-------------------------------------
  286. # **SHOW FACE EFFECT
  287. # * For both Face Systems *
  288. #----------------------------------
  289. FADE_EFFECT = true # Turn on/off fade effect (true/false)
  290. # $nms.face_fade = true/false
  291. FADE_SPEED = 20 # Speed up face's fade effect by increase this number
  292. FADE_ONLY_FIRST = true # Use Fade Effect only in first message window?
  293.  
  294. MOVE_EFFECT = true # Turn on/off "move in" effect (true/false)
  295. # $nms.face_move = true/false
  296. MOVE_SPEED = 10 # Speed up face's "move in" effect by increase this number
  297. MOVE_ONLY_FIRST = true # Use Move Effect only in first message window?
  298.  
  299. FADE_MOVE_WHEN_USE_NEW_FACE = false
  300. # Use Fade and Move effect when change Face graphic
  301. # (In case using FADE_ONLY_FIRST and MOVE_ONLY_FIRST)
  302.  
  303. #-------------------------------
  304. # ** NEO FACE SYSTEM
  305. #----------------------------
  306. EightFaces_File = false
  307. # Use 8 Faces per file (or) 1 Face per file (true/false)
  308.  
  309. #-------------------------------
  310. # ** ANIMATED FACE SYSTEM
  311. #----------------------------
  312. ANIMATE_FACE_DELAY = 6 # Face animate every _ frame
  313. # $nms.animf_delay = (number)
  314.  
  315. ANIMATE_FACE_CONTINUE = false # Face continue to animate after text stop writing?
  316. # $nms.animf_cont = (true/false)
  317.  
  318. #------------------------------------
  319. # ? NAME BOX SYSTEM
  320. #----------------------------------
  321. NAMEBOX_SKIN = 'Window' # Windowskin of Name Box (In folder 'Graphics/System')
  322. NAMEBOX_OPACITY = 255 # Name Box Opacity when using 'Normal Background' message
  323. # (Lowest 0 - 255 Highest)
  324. NAMEBOX_OPACITY_DIM_BG = 0 # Name Box Opacity when using 'Dim Background'
  325. NAMEBOX_OPACITY_NO_BG = 0 # Name Box Opacity when using 'Transparent' Background
  326. NAMEBOX_BACK_OPACITY = 180 # Name Box Background Opacity
  327.  
  328. NAMEBOX_X_PLUS_NOR = 400 # Additional Name Box X [Horizontal] for Normal Face Name Box
  329. NAMEBOX_X_PLUS_NEO = 400 # Additional Name Box X for Neo Face Name Box
  330. NAMEBOX_Y_PLUS = 0 # Move Name Box & Text Vertically
  331. NAMEBOX_Y_PLUS_TOP = 200
  332. # Move Name Box & Text Vertically if message box is on Top
  333.  
  334. NAMEBOX_TEXT_FONT = Font.default_name # Name Text Font's Name
  335. NAMEBOX_TEXT_SIZE = Font.default_size # Name Text Font's Size
  336. NAMEBOX_TEXT_HEIGHT_PLUS = 2 # Increase Name Text Height (For Big Size Text)
  337.  
  338. NAMEBOX_TEXT_BOLD = false # Make Text in Name Box Bold
  339. NAMEBOX_TEXT_OUTLINE = false # Make Black Outline around Text (Good with Opacity = 0)
  340. NAMEBOX_TEXT_DEFAULT_COLOR = [255,255,255]#[255,255,255] # [Red,Green,Blue]: Name Text Color (RGB)
  341. # You can easily find color code for RGB (Red Green Blue) color in Google :)
  342. # You are allow to change color in game by call script:
  343. # $nms.color = [Red,Green,Blue]
  344.  
  345. NAMEBOX_TEXT_AFTER_NAME = "" # Add Text after Name, leave "" to disable.
  346.  
  347. NAMEBOX_BOX_WIDTH_PLUS = 6 # Increase Name Box Width
  348. NAMEBOX_BOX_HEIGHT_PLUS = 7 # Increase Name Box Height
  349.  
  350. MOVE_NAMEBOX = true
  351. # (true/false) Move Text Box to Right Side if showing Face in Right side.
  352.  
  353. #---------------------------------
  354. # ? TEXT TYPING SOUND SYSTEM
  355. #-------------------------------
  356. TYPING_SOUND = true # Use Typing Sound?
  357. # $nms.typ_se = true/false
  358. TYPING_SOUND_FILE = 'select2'
  359. # Sound File Name for Typing Sound (Must be in Folder 'Audio/SE')
  360. # $nms.typ_file = 'filename'
  361. TYPING_SOUND_VOLUME = 65 # Typing Sound's Volume
  362. # $nms.typ_vol = 0 - 100
  363. TYPING_SOUND_SKIP = 3
  364. # How many frames you want to skip before play typing sound again?
  365. # $nms.typ_skip = (no. of frames)
  366. #---------------------------------
  367. # [END] SETUP SCRIPT PART
  368. #-------------------------------
  369. end
  370. $worale = {} if $worale == nil
  371. $worale["NMS"] = true
  372.  
  373. class Window_Message < Window_Selectable
  374. #--------------------------------------------------------------------------
  375. # ? ALIAS
  376. #--------------------------------------------------------------------------
  377. alias wor_nms_winmsg_ini initialize
  378. def initialize
  379. wor_nms_winmsg_ini
  380. $nms = $game_message
  381. contents.font.name = $nms.nms_fontname
  382. contents.font.size = $nms.nms_fontsize
  383. @face = Sprite.new
  384. @face.z = self.z + 5
  385. @nametxt = Sprite.new
  386. @nametxt.z = self.z + 15
  387. @namebox = nil
  388. @ori_x = 0
  389. @name_text = nil
  390. @showtime = 0 # To check if this is first time it shows message (For face)
  391. @face_data = Array.new(3)
  392. @face_data_old = Array.new(3)
  393.  
  394. #NMS 2++
  395. self.width = $nms.msg_w
  396. self.height = $nms.msg_h
  397. update_window_size(true)
  398. self.x = $nms.msg_x
  399.  
  400. @typse_count = 0
  401. @delay_text = 0
  402. @no_press_input = false
  403. @biggest_text_height = 0
  404. @all_text_width = 0
  405. @animf_dl = 0 # Animation Face Delay
  406. @animf = false # Using Animation Face?
  407. @animf_ind = 0 # Animation Face Index
  408. @pop = nil # Pop ID
  409. end
  410. #--------------------------------------------------------------------------
  411. # ? ??
  412. #--------------------------------------------------------------------------
  413. def dispose
  414. super
  415. dispose_gold_window
  416. dispose_number_input_window
  417. dispose_back_sprite
  418. end
  419. #--------------------------------------------------------------------------
  420. # ? EDITED
  421. #--------------------------------------------------------------------------
  422. def update
  423. super
  424. if self.visible == true
  425. update_back_sprite
  426. update_gold_window
  427. update_number_input_window
  428. update_show_fast
  429. update_window_size
  430. update_animate_face if @animf
  431.  
  432. @typse_count -= 1 if @typse_count > 0
  433.  
  434. if @name_text != nil
  435. draw_name(@name_text,self.x,self.y)
  436. end
  437. if @face.bitmap != nil
  438. # UPDATE FADE IN EFFECT
  439. if @face.opacity < 255
  440. @face.opacity += FADE_SPEED
  441. end
  442. # UPDATE MOVE IN EFFECT
  443. if $nms.face_move and @ori_x != @face.x
  444. if (@ori_x > @face.x and @face.x + MOVE_SPEED < @ori_x) or (@ori_x < @face.x and @face.x - MOVE_SPEED > @ori_x)
  445. @face.x += MOVE_SPEED if @ori_x > @face.x
  446. @face.x -= MOVE_SPEED if @ori_x < @face.x
  447. else
  448. @face.x = @ori_x
  449. end
  450. end
  451. end
  452. end
  453. unless @opening or @closing
  454. if @wait_count > 0
  455. @wait_count -= 1
  456. elsif self.pause
  457. input_pause
  458. elsif self.active
  459. input_choice
  460. elsif @number_input_window.visible
  461. input_number
  462. elsif @text != nil
  463. if @delay_text > 0
  464. @delay_text -= 1
  465. else
  466. update_message
  467. end
  468. elsif continue?
  469. @showtime += 1
  470. start_message
  471. open
  472. $game_message.visible = true
  473. else
  474. close
  475. @showtime = 0
  476. if @face.bitmap != nil
  477. @face.bitmap.dispose
  478. end
  479. clear_namebox if @namebox != nil
  480. $game_message.visible = @closing
  481. end
  482. end
  483. end
  484. #--------------------------------------------------------------------------
  485. # ? NEW
  486. #--------------------------------------------------------------------------
  487. def update_window_size(direct = false, create_bitmap = true)
  488. if (self.width != $nms.msg_w or self.height != $nms.msg_h) or direct
  489. self.width = $nms.msg_w if $nms.msg_w > 32
  490. self.height = $nms.msg_h if $nms.msg_h > 32
  491. create_contents if create_bitmap
  492. end
  493. end
  494. #--------------------------------------------------------------------------
  495. # ? ???????????
  496. #--------------------------------------------------------------------------
  497. def create_gold_window
  498. @gold_window = Window_Gold.new(384, 0)
  499. @gold_window.openness = 0
  500. end
  501. #--------------------------------------------------------------------------
  502. # ? ????????????
  503. #--------------------------------------------------------------------------
  504. def create_number_input_window
  505. @number_input_window = Window_NumberInput.new
  506. @number_input_window.visible = false
  507. end
  508. #--------------------------------------------------------------------------
  509. # ? ??????????
  510. #--------------------------------------------------------------------------
  511. def create_back_sprite
  512. @back_sprite = Sprite.new
  513. @back_sprite.bitmap = @old_mback = Cache.system($game_message.mback)
  514. @back_sprite.opacity = @old_mback_opac = $game_message.mback_opac
  515. @back_sprite.visible = (@background == 1)
  516. @back_sprite.z = 190
  517. end
  518. #--------------------------------------------------------------------------
  519. # ? ???????????
  520. #--------------------------------------------------------------------------
  521. def dispose_gold_window
  522. @gold_window.dispose
  523. end
  524. #--------------------------------------------------------------------------
  525. # ? ????????????
  526. #--------------------------------------------------------------------------
  527. def dispose_number_input_window
  528. @number_input_window.dispose
  529. end
  530. #--------------------------------------------------------------------------
  531. # ? ??????????
  532. #--------------------------------------------------------------------------
  533. def dispose_back_sprite
  534. @back_sprite.dispose
  535. end
  536. #--------------------------------------------------------------------------
  537. # ? ???????????
  538. #--------------------------------------------------------------------------
  539. def update_gold_window
  540. @gold_window.update
  541. end
  542. #--------------------------------------------------------------------------
  543. # ? ????????????
  544. #--------------------------------------------------------------------------
  545. def update_number_input_window
  546. @number_input_window.update
  547. end
  548. #--------------------------------------------------------------------------
  549. # ? ??????????
  550. #--------------------------------------------------------------------------
  551. def update_back_sprite
  552. @back_sprite.visible = (@background == 1)
  553. @back_sprite.y = y - 16
  554. @back_sprite.opacity = $nms.mback_opac > openness ? openness : $nms.mback_opac
  555. @back_sprite.update
  556. end
  557. #--------------------------------------------------------------------------
  558. # ? ?????????
  559. #--------------------------------------------------------------------------
  560. def update_show_fast
  561. if self.pause or self.openness < 255
  562. @show_fast = false
  563. elsif Input.trigger?(Input::C) and @wait_count < 2 and !@no_press_input
  564. @show_fast = true
  565. elsif not Input.press?(Input::C)
  566. @show_fast = false
  567. end
  568. if @show_fast and @wait_count > 0
  569. @wait_count -= 1
  570. end
  571. end
  572. #--------------------------------------------------------------------------
  573. # ? ????????????????????
  574. #--------------------------------------------------------------------------
  575. def continue?
  576. return true if $game_message.num_input_variable_id > 0
  577. return false if $game_message.texts.empty?
  578. if self.openness > 0 and not $game_temp.in_battle
  579. return false if @background != $game_message.background
  580. return false if @position != $game_message.position
  581. end
  582. return true
  583. end
  584. #--------------------------------------------------------------------------
  585. # ? EDITED: NMS 2.2+
  586. #--------------------------------------------------------------------------
  587. def start_message
  588. @all_text_width = 0
  589. @pop = nil
  590.  
  591. @text = ""
  592. @text_line = $game_message.texts.size < $game_message.max_line ? $game_message.texts.size + 1 : MAX_LINE + 1
  593. for i in 0...$game_message.texts.size
  594. # Change " " to "" (Spacing for choice)
  595. @text += "" if i >= $game_message.choice_start
  596. @text += $game_message.texts[i].clone + "\x00"
  597. end
  598.  
  599. @item_max = $game_message.choice_max
  600. convert_special_characters
  601. reset_window
  602. update_window_size
  603. new_page
  604. end
  605. #--------------------------------------------------------------------------
  606. # ? EDITED
  607. #--------------------------------------------------------------------------
  608. def new_page
  609. @animf = false
  610. contents.clear
  611.  
  612. if @face.bitmap != nil
  613. @face.bitmap.dispose
  614. end
  615. if $game_message.face_name.empty?
  616. @contents_x = TEXT_X_PLUS
  617. else
  618. nms_draw_new_face
  619. # CHECK FOR MOVE EFFECT
  620. @ori_x = @face.x
  621. if $nms.face_move and ((MOVE_ONLY_FIRST and @showtime <= 1) or (MOVE_ONLY_FIRST == false))
  622. if $game_message.side == 0 or $game_message.side == 1
  623. @face.x = 0 - @face.width
  624. else
  625. @face.x = Graphics.width
  626. end
  627. end
  628. @contents_x = get_x_face
  629. end
  630. @main_contents_x = @contents_x
  631. @contents_y = 0
  632. @line_count = 0
  633. @typse_count = 0
  634. @show_fast = false
  635. @line_show_fast = false
  636. @pause_skip = false
  637. contents.font.color = text_color(0)
  638. @contents_x += CHOICE_INPUT_X_PLUS if $game_message.choice_max > 00
  639.  
  640. if @old_mback != Cache.system($nms.mback) or @old_mback_opac != $nms.mback_opac
  641. dispose_back_sprite; create_back_sprite
  642. end
  643.  
  644. @no_press_input = false
  645. self.oy = 0
  646. end
  647. #--------------------------------------------------------------------------
  648. # ? EDITED
  649. #--------------------------------------------------------------------------
  650. def new_line
  651. biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH
  652. @contents_y += biggest
  653. if $nms.txt_scrl and @contents_y >= contents.height and @text != ""
  654. rect = Rect.new(0, biggest, contents.width, contents.height - biggest)
  655. cont_s = Bitmap.new(contents.width,contents.height)
  656. cont_s.blt(0, 0, contents, rect)
  657. rect_s = Rect.new(0,0,contents.width,contents.height)
  658. contents.clear_rect(0, 0, contents.width, contents.height)
  659. contents.blt(0, 0, cont_s, rect_s)
  660. @contents_y = rect.height
  661. cont_s.dispose
  662. @show_fast = false
  663. @no_press_input = true
  664. end
  665. @contents_x = @main_contents_x
  666. @contents_x += CHOICE_INPUT_X_PLUS if $game_message.choice_max > 0
  667. @biggest_text_height = WLH
  668. @line_count += 1
  669. @line_show_fast = false
  670. end
  671. #--------------------------------------------------------------------------
  672. # ? EDITED
  673. #--------------------------------------------------------------------------
  674. def convert_special_characters
  675. clear_namebox if @namebox != nil
  676.  
  677. # Woratana's :: Quick Text
  678. @text.gsub!(/\\QT\[([0-9]+)\]/i) { $nms.qt[$1.to_i] }
  679.  
  680. #--------------------------
  681. # DEFAULT FEATURES
  682. #-----------------------
  683. @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
  684. @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
  685. @text.gsub!(/\\C\[(.*?)\]/i) { "\x01{#{$1}}" }
  686. @text.gsub!(/\\G/i) { "\x02" }
  687. @text.gsub!(/\\\./) { "\x03" }
  688. @text.gsub!(/\\\|/) { "\x04" }
  689. @text.gsub!(/\\!/) { "\x05" }
  690. @text.gsub!(/\\>/) { "\x06" }
  691. @text.gsub!(/\\</) { "\x07" }
  692. @text.gsub!(/\\\^/) { "\x08" }
  693. @text.gsub!(/\\\\/) { "\\" }
  694.  
  695. #--------------------------
  696. # * NMS FEATURES!!
  697. #-----------------------
  698. # Woratana's :: Draw Weapon Name + Icon
  699. @text.gsub!(/\\DW\[([0-9]+)\]/i) { "\x83[#{$data_weapons[$1.to_i].icon_index}]\x01{#{NMS_WEAPON_NAME_COLOR_ID}}\\nw[#{$1.to_i}]\x01{#{$nms.last_color}}"}
  700. # Woratana's :: Draw Item Name + Icon
  701. @text.gsub!(/\\DI\[([0-9]+)\]/i) { "\x83[#{$data_items[$1.to_i].icon_index}]\x01{#{NMS_ITEM_NAME_COLOR_ID}}\\ni[#{$1.to_i}]\x01{#{$nms.last_color}}" }
  702. # Woratana's :: Draw Armor Name + Icon
  703. @text.gsub!(/\\DA\[([0-9]+)\]/i) { "\x83[#{$data_armors[$1.to_i].icon_index}]\x01{#{NMS_ARMOR_NAME_COLOR_ID}}\\na[#{$1.to_i}]\x01{#{$nms.last_color}}"}
  704. # Woratana's :: Draw Skill Name + Icon
  705. @text.gsub!(/\\DS\[([0-9]+)\]/i) { "\x83[#{$data_skills[$1.to_i].icon_index}]\x01{#{NMS_ITEM_NAME_COLOR_ID}}\\ns[#{$1.to_i}]\x01{#{$nms.last_color}}"}
  706.  
  707. # Woratana's :: Call Animation
  708. @text.gsub!(/\\ANI\[([0-9]+)\]/i) { "\x80[#{$1}]" }
  709. # Woratana's :: Call Balloon
  710. @text.gsub!(/\\BAL\[([0-9]+)\]/i) { "\x81[#{$1}]" }
  711. # Woratana's :: Call Common Event
  712. @text.gsub!(/\\CE\[([0-9]+)\]/i) { "\x82[#{$1}]" }
  713. # Woratana's :: Draw Icon
  714. @text.gsub!(/\\IC\[([0-9]+)\]/i) { "\x83[#{$1}]" }
  715.  
  716. # Woratana's :: Map Name
  717. @text.gsub!(/\\MAP/i) { nms_get_map_name }
  718. # Woratana's :: Actor Class Name
  719. @text.gsub!(/\\NC\[([0-9]+)\]/i) { $data_classes[$game_actors[$1.to_i].class_id].name }
  720. # Woratana's :: Party Actor Name
  721. @text.gsub!(/\\NP\[([0-9]+)\]/i) { $game_party.members[($1.to_i - 1)].name }
  722. # Woratana's :: Monster Name
  723. @text.gsub!(/\\NM\[([0-9]+)\]/i) { $data_enemies[$1.to_i].name }
  724. # Woratana's :: Troop Name
  725. @text.gsub!(/\\NT\[([0-9]+)\]/i) { $data_troops[$1.to_i].name }
  726. # Woratana's :: Item Name
  727. @text.gsub!(/\\NI\[([0-9]+)\]/i) { $data_items[$1.to_i].name }
  728. # Woratana's :: Weapon Name
  729. @text.gsub!(/\\NW\[([0-9]+)\]/i) { $data_weapons[$1.to_i].name }
  730. # Woratana's :: Armor Name
  731. @text.gsub!(/\\NA\[([0-9]+)\]/i) { $data_armors[$1.to_i].name }
  732. # Woratana's :: Skill Name
  733. @text.gsub!(/\\NS\[([0-9]+)\]/i) { $data_skills[$1.to_i].name }
  734. # Woratana's :: Item Price
  735. @text.gsub!(/\\PRICE\[([0-9]+)\]/i) { $data_items[$1.to_i].price.to_s }
  736.  
  737. # Woratana's :: Font Name Change
  738. @text.gsub!(/\\FN\[(.*?)\]/i) { "\x84[#{$1}]" }
  739. # Woratana's :: Font Size Change
  740. @text.gsub!(/\\FS\[(.*?)\]/i) { "\x85[#{$1}]" }
  741. # Woratana's :: Reset Font Name
  742. @text.gsub!(/\\REF/i) { "\x86" }
  743. # Woratana's :: Reset Font Size
  744. @text.gsub!(/\\RES/i) { "\x87" }
  745. # Woratana's :: BOLD Text
  746. @text.gsub!(/\\B/i) { "\x88" }
  747. # Woratana's :: ITALIC Text
  748. @text.gsub!(/\\I/i) { "\x89" }
  749. # Woratana's :: Text DELAY
  750. @text.gsub!(/\\DELAY\[([0-9]+)\]/i) { "\x90[#{$1}]"}
  751. # Woratana's :: Reset Text Delay
  752. @text.gsub!(/\\RED/i) { "\x91" }
  753. # Woratana's :: Turn On/Off Letter by Letter
  754. @text.gsub!(/\\LBL/i) { "\x92" }
  755.  
  756. # Woratana's NeoFace System
  757. @text.scan(/\\SD\[([-,0-9]+)\]/i)
  758. if $1.to_s != ""
  759. $game_message.side = $1.to_i
  760. @text.sub!(/\\SD\[([-,0-9]+)\]/i) {}
  761. end
  762.  
  763. # Woratana's :: Name Box
  764. @text.scan(/\\NB\[(.*?)\]/i)
  765. if $1.to_s != ""
  766. n_text = $1.to_s.gsub(/\x01\{(.*?)\}/i) {} # Clear If there's Color
  767. @name_text = n_text
  768. @text.sub!(/\\NB\[(.*?)\]/i) {}
  769. end
  770.  
  771. # Woratana's :: Repeat Name Box
  772. @text.gsub!(/\\RNB\[(.*?)\]/i) do
  773. $game_message._name = $1.to_s
  774. a = ""
  775. end
  776.  
  777. # NMS 2++
  778. # Woratana's :: SHADOW Text
  779. @text.gsub!(/\\SH/i) { "\x93" }
  780. # Woratana's :: Cancel Skip Text Button
  781. @text.gsub!(/\\CB/i) { "\x94" }
  782. # Woratana's :: Wait X Frame
  783. @text.gsub!(/\\W\[([0-9]+)\]/i) { "\x95[#{$1}]" }
  784. # Woratana's :: Add Space X Pixel
  785. @text.gsub!(/\\SC\[([0-9]+)\]/i) { "\x96[#{$1}]" }
  786.  
  787. # Woratana's :: Play SE
  788. @text.gsub!(/\\SE\[(.*?)\]/i) { "\x97[#{$1}]" }
  789. # Woratana's :: Play ME
  790. @text.gsub!(/\\ME\[(.*?)\]/i) { "\x98[#{$1}]" }
  791. # Woratana's :: Play BGM
  792. @text.gsub!(/\\BGM\[(.*?)\]/i) { "\x99[#{$1}]" }
  793.  
  794. # Woratana's :: Start New Line
  795. @text.gsub!(/\\NL/i) { "\x09" }
  796. # Woratana's :: Turn ON/OFF Typing Sound
  797. @text.gsub!(/\\TYP/i) { "\x10" }
  798. # Woratana's :: Draw Picture
  799. @text.gsub!(/\\DP\[(.*?)\]/i) { "\x11[#{$1}]" }
  800.  
  801. # Woratana's :: Draw Face
  802. @text.gsub!(/\\FA\{(.*?)\}/i) { "\x12{#{$1}}" }
  803.  
  804. # Woratana's :: Temporary Width
  805. @text.scan(/\\WW\[([-,0-9]+)\]/i)
  806. if $1.to_s != ''
  807. $nms.msg_temp_w = $1.to_i
  808. @text.sub!(/\\WW\[([-,0-9]+)\]/i) {}
  809. end
  810. # Woratana's :: Temporary Height
  811. @text.scan(/\\WH\[([-,0-9]+)\]/i)
  812. if $1.to_s != ''
  813. $nms.msg_temp_h = $1.to_i
  814. @text.sub!(/\\WH\[([-,0-9]+)\]/i) {}
  815. end
  816. # Woratana's :: Temporary X
  817. @text.scan(/\\WX\[([-,0-9]+)\]/i)
  818. if $1.to_s != ''
  819. $nms.msg_temp_x = $1.to_i
  820. @text.sub!(/\\WX\[([-,0-9]+)\]/i) {}
  821. end
  822. # Woratana's :: Temporary Y
  823. @text.scan(/\\WY\[([-,0-9]+)\]/i)
  824. if $1.to_s != ''
  825. $nms.msg_temp_y = $1.to_i
  826. @text.sub!(/\\WY\[([-,0-9]+)\]/i) {}
  827. end
  828.  
  829. # Woratana's :: Remove text list
  830. NMS_REMOVE_LIST.each {|i| @text.gsub!(/#{i}/i) {} }
  831.  
  832. # Woratana's :: Pop Text
  833. @text.scan(/\\P\[(.*?)\]/i)
  834. if $1.to_s != ""
  835. @pop = $1.to_i
  836. contents.font.name = $nms.nms_fontname if contents.font.name != $nms.nms_fontname
  837. contents.font.size = $nms.nms_fontsize if contents.font.size != $nms.nms_fontsize
  838. a = @text.split(/\x00/)
  839. for i in 0..(a.size - 1)
  840. text_width = contents.text_size(a[i]).width
  841. @all_text_width = text_width if @all_text_width < text_width
  842. end
  843. nms_draw_new_face
  844. if @face.bitmap != nil
  845. if get_x_face == 0 and MOVE_TEXT
  846. @all_text_width += (@face.width + TEXT_X_PLUS)
  847. else
  848. @all_text_width += get_x_face
  849. end
  850. @face.bitmap.dispose
  851. @face.bitmap = nil
  852. end
  853. @text.sub!(/\\P\[(.*?)\]/i) {}
  854. end
  855.  
  856. @name_text = $game_message._name if @name_text == nil and $game_message._name != ""
  857. end
  858. #--------------------------------------------------------------------------
  859. # ? EDIT: NMS 2.2++
  860. #--------------------------------------------------------------------------
  861. def reset_window
  862. @background = $game_message.background
  863. @position = $game_message.position
  864. if @background == 0
  865. self.opacity = 255
  866. else
  867. self.opacity = 0
  868. end
  869. # Calculate Window X/Y and Size depends on Pop or normal message
  870. if @pop != nil
  871. $nms.msg_h = [((@text_line * WLH) + 8), $nms.msg_h_user].min
  872. $nms.msg_w = @all_text_width + 32
  873.  
  874. case @pop
  875. when 0 # Player
  876. set_window_xy($game_player)
  877. when -1 # This Event
  878. set_window_xy($game_map.events[$game_message.event_id])
  879. else # Event ID
  880. set_window_xy($game_map.events[@pop])
  881. end
  882. else
  883. $nms.msg_h = ((((@text_line * WLH) + 8) > $nms.msg_h_user) and ($nms.txt_scrl == false)) ? ((@text_line * WLH) + 8) : $nms.msg_h_user
  884. $nms.msg_w = NMS_MSGWIN_WIDTH
  885. self.x = $nms.msg_x
  886. case @position
  887. when 0 # Down
  888. self.y = 0
  889. @gold_window.y = 360
  890. when 1 # Middle
  891. self.y = ((Graphics.height - $nms.msg_h) / 2)
  892. @gold_window.y = 0
  893. when 2 # Up
  894. self.y = Graphics.height - $nms.msg_h
  895. @gold_window.y = 0
  896. end
  897. end
  898. # Temporary Size & Position
  899. if !$nms.msg_temp_w.nil?
  900. $nms.msg_w = $nms.msg_temp_w
  901. $nms.msg_temp_w = nil
  902. end
  903. if !$nms.msg_temp_h.nil?
  904. $nms.msg_h = $nms.msg_temp_h
  905. $nms.msg_temp_h = nil
  906. end
  907. if !$nms.msg_temp_x.nil?
  908. self.x = $nms.msg_temp_x
  909. $nms.msg_temp_x = nil
  910. end
  911. if !$nms.msg_temp_y.nil?
  912. self.y = $nms.msg_temp_y
  913. $nms.msg_temp_y = nil
  914. end
  915. # Fix Window Position if it's out of screen
  916. self.x = 0 if self.x < 0
  917. self.x = Graphics.width - $nms.msg_w if (self.x + $nms.msg_w) > Graphics.width
  918. self.y = 0 if self.y < 0
  919. self.y = Graphics.height - $nms.msg_h if (self.y + $nms.msg_h) > Graphics.height
  920. end
  921. #--------------------------------------------------------------------------
  922. # ? SET Window XY for Pop Message
  923. #--------------------------------------------------------------------------
  924. def set_window_xy(chara)
  925. char_x = chara.screen_x
  926. char_y = chara.screen_y
  927. self.x = char_x - ($nms.msg_w / 2)
  928. self.y = ((char_y - 32 - $nms.msg_h) >= 0) ? (char_y - 32 - $nms.msg_h) : (char_y + 32)
  929. end
  930. #--------------------------------------------------------------------------
  931. # ? ????????
  932. #--------------------------------------------------------------------------
  933. def terminate_message
  934. self.active = false
  935. self.pause = false
  936. self.index = -1
  937. @gold_window.close
  938. @number_input_window.active = false
  939. @number_input_window.visible = false
  940. $game_message.main_proc.call if $game_message.main_proc != nil
  941. $game_message.clear
  942. end
  943. #--------------------------------------------------------------------------
  944. # ? EDITED
  945. #--------------------------------------------------------------------------
  946. def update_message
  947. loop do
  948. c = @text.slice!(/./m)
  949. case c
  950. when nil
  951. finish_message
  952. break
  953. when "\x00"
  954. new_line if !$nms.txt_unl
  955. if @line_count >= $game_message.max_line
  956. unless @text.empty?
  957. self.pause = true
  958. break
  959. end
  960. end
  961. when "\x80"
  962. @text.sub!(/\[([0-9]+)\]/, "")
  963. $game_map.events[$game_message.event_id].animation_id = $1.to_i
  964. when "\x81"
  965. @text.sub!(/\[([0-9]+)\]/, "")
  966. $game_map.events[$game_message.event_id].balloon_id = $1.to_i
  967. when "\x82"
  968. @text.sub!(/\[([0-9]+)\]/, "")
  969. a = $game_map.interpreter.params[0]
  970. $game_map.interpreter.params[0] = $1.to_i
  971. $game_map.interpreter.command_117
  972. $game_map.interpreter.params[0] = a
  973. when "\x83"
  974. @text.sub!(/\[([0-9]+)\]/, "")
  975. bitmap = Cache.system("Iconset")
  976. icon_index = $1.to_i
  977. # Check for Auto Cut
  978. new_line if $nms.txt_cut and (@contents_x + 24 > contents.width)
  979. # Draw ICON
  980. draw_icon(icon_index, @contents_x, @contents_y, true)
  981. @contents_x += 24
  982. when "\x84"
  983. @text.sub!(/\[(.*?)\]/, "")
  984. $nms.nms_fontname = $1.to_s
  985. next
  986. when "\x85"
  987. @text.sub!(/\[([0-9]+)\]/, "")
  988. $nms.nms_fontsize = $1.to_i; next
  989. when "\x86"
  990. $nms.nms_fontname = NMS_FONT_NAME; next
  991. when "\x87"
  992. $nms.nms_fontsize = NMS_FONT_SIZE; next
  993. when "\x88"
  994. contents.font.bold = contents.font.bold == true ? false : true
  995. next
  996. when "\x89"
  997. contents.font.italic = contents.font.italic == true ? false : true
  998. next
  999. when "\x90"
  1000. @text.sub!(/\[([0-9]+)\]/, "")
  1001. $nms.text_delay = $1.to_i; next
  1002. when "\x91"
  1003. $nms.text_delay = NMS_DELAY_PER_LETTER; next
  1004. when "\x92"
  1005. $nms.lbl = $nms.lbl == true ? false : true; next
  1006. when "\x93"
  1007. contents.font.shadow = contents.font.shadow == true ? false : true
  1008. next
  1009. when "\x94"
  1010. @no_press_input = @no_press_input == true ? false : true
  1011. next
  1012. when "\x95"
  1013. @text.sub!(/\[([0-9]+)\]/, "")
  1014. @wait_count = $1.to_i
  1015. break
  1016. when "\x96"
  1017. @text.sub!(/\[([0-9]+)\]/, "")
  1018. @contents_x += $1.to_i
  1019. next
  1020. when "\x97"
  1021. @text.sub!(/\[(.*?)\]/, "")
  1022. RPG::SE.new($1).play
  1023. when "\x98"
  1024. @text.sub!(/\[(.*?)\]/, "")
  1025. RPG::ME.new($1).play
  1026. when "\x99"
  1027. @text.sub!(/\[(.*?)\]/, "")
  1028. RPG::BGM.new($1).play
  1029. when "\x09"
  1030. new_line
  1031. when "\x10"
  1032. $nms.typ_se = !$nms.typ_se
  1033. when "\x11"
  1034. @text.sub!(/\[(.*?)\]/, "")
  1035. bitmap = Cache.system($1.to_s)
  1036. rect = Rect.new(0,0,0,0)
  1037. rect.width = bitmap.width
  1038. rect.height = bitmap.height
  1039. # Check for Auto Cut & Scroll
  1040. if (@contents_x + bitmap.width > contents.width)
  1041. if $nms.txt_cut; new_line
  1042. elsif $nms.txt_scrl_hori; nms_scroll_hori(bitmap.width)
  1043. end
  1044. end
  1045. # Draw Image
  1046. self.contents.blt(@contents_x, @contents_y, bitmap, rect)
  1047. @contents_x += bitmap.width
  1048. @biggest_text_height = bitmap.height if bitmap.height > @biggest_text_height
  1049. bitmap.dispose
  1050. when "\x12"
  1051. @text.sub!(/\{(.*?)\}/, "")
  1052. a = $1.to_s.split(',')
  1053. $nms.face_name = a[0]
  1054. $nms.face_index = a[1].to_i
  1055. $nms.side = a[2].to_i unless a[2].nil?
  1056. nms_draw_new_face
  1057. @ori_x = @face.x
  1058. when "\x01"
  1059. @text.sub!(/\{(.*?)\}/, "")
  1060. color_code = $1.to_s
  1061. if color_code.include?('#')
  1062. color_code.sub!(/([0123456789ABCDEF]+)/, "")
  1063. contents.font.color = get_hex($1)
  1064. else
  1065. $nms.last_color = color_code.to_i
  1066. contents.font.color = text_color($nms.last_color)
  1067. end
  1068. next
  1069. when "\x02"
  1070. @gold_window.refresh
  1071. @gold_window.open
  1072. when "\x03"
  1073. @wait_count = 15
  1074. break
  1075. when "\x04"
  1076. @wait_count = 60
  1077. break
  1078. when "\x05"
  1079. self.pause = true
  1080. break
  1081. when "\x06"
  1082. @line_show_fast = true
  1083. when "\x07"
  1084. @line_show_fast = false
  1085. when "\x08"
  1086. @pause_skip = true
  1087. else
  1088. contents.font.name = $nms.nms_fontname if contents.font.name != $nms.nms_fontname
  1089. contents.font.size = $nms.nms_fontsize if contents.font.size != $nms.nms_fontsize
  1090. c_width = contents.text_size(c).width
  1091.  
  1092. # Check for Text Cut & Scroll Horizontal
  1093. if (@contents_x + c_width > contents.width)
  1094. if $nms.txt_cut; new_line
  1095. elsif $nms.txt_scrl_hori
  1096. nms_scroll_hori(c_width)
  1097. @wait_count = $nms.txt_scrl_hori_delay
  1098. @text = c + @text
  1099. return
  1100. end
  1101. end
  1102. nms_line_height = contents.text_size(c).height
  1103. contents.draw_text(@contents_x, @contents_y, 40, nms_line_height, c)
  1104. @contents_x += c_width
  1105. # Change Biggest Text Height
  1106. @biggest_text_height = nms_line_height if nms_line_height > @biggest_text_height
  1107.  
  1108. # Play Typing Sound
  1109. if $nms.typ_se and @typse_count <= 0
  1110. RPG::SE.new($nms.typ_file, $nms.typ_vol).play
  1111. @typse_count += $nms.typ_skip
  1112. end
  1113. #Show Fast & Text Delay
  1114. @show_fast = true if $nms.lbl == false
  1115.  
  1116. @delay_text += $nms.text_delay
  1117. end
  1118. break unless @show_fast or @line_show_fast
  1119. end
  1120. end
  1121. #--------------------------------------------------------------------------
  1122. # ? ??????????
  1123. #--------------------------------------------------------------------------
  1124. def finish_message
  1125. if $game_message.choice_max > 0
  1126. start_choice
  1127. elsif $game_message.num_input_variable_id > 0
  1128. start_number_input
  1129. elsif @pause_skip
  1130. terminate_message
  1131. else
  1132. self.pause = true
  1133. end
  1134. @wait_count = 10
  1135. @text = nil
  1136. end
  1137. #--------------------------------------------------------------------------
  1138. # ? ??????
  1139. #--------------------------------------------------------------------------
  1140. def start_choice
  1141. self.active = true
  1142. self.index = 0
  1143. end
  1144. #--------------------------------------------------------------------------
  1145. # ? EDITED
  1146. #--------------------------------------------------------------------------
  1147. def start_number_input
  1148. digits_max = $game_message.num_input_digits_max
  1149. number = $game_variables[$game_message.num_input_variable_id]
  1150. @number_input_window.digits_max = digits_max
  1151. @number_input_window.number = number
  1152. if $game_message.face_name.empty? or MOVE_TEXT == false
  1153. @number_input_window.x = x - 23
  1154. else
  1155. case $game_message.side
  1156. when 0
  1157. @number_input_window.x = (x + 112) - 23
  1158. when 1
  1159. @number_input_window.x = (x + text_x) - 23
  1160. when 2
  1161. @number_input_window.x = x - 23
  1162. when -1
  1163. @number_input_window.x = x - 23
  1164. end
  1165. end
  1166. @number_input_window.x += CHOICE_INPUT_X_PLUS
  1167. @number_input_window.y = y + @contents_y
  1168. @number_input_window.active = true
  1169. @number_input_window.visible = true
  1170. @number_input_window.update
  1171. end
  1172. #--------------------------------------------------------------------------
  1173. # ? EDITED
  1174. #--------------------------------------------------------------------------
  1175. def update_cursor
  1176. if @index >= 0
  1177. if $game_message.face_name.empty?
  1178. x = TEXT_X_PLUS
  1179. else
  1180. x = get_x_face
  1181. end
  1182. y = ($game_message.choice_start + @index) * WLH
  1183. # CHANGE WIDTH OF CURSOR FOR CHOICE SELECT
  1184. if $game_message.face_name.empty? or MOVE_TEXT == false
  1185. facesize = x
  1186. else
  1187. facesize = get_x_face
  1188. facesize += @face.width if $game_message.side == 2
  1189. facesize += @face.width + 16 if $game_message.side == -1
  1190. end
  1191. self.cursor_rect.set(x, y, contents.width - facesize, WLH)
  1192. else
  1193. self.cursor_rect.empty
  1194. end
  1195. end
  1196.  
  1197. #--------------------------------------------------------------------------
  1198. # ? ?????????
  1199. #--------------------------------------------------------------------------
  1200. def input_pause
  1201. if Input.trigger?(Input::B) or Input.trigger?(Input::C)
  1202. self.pause = false
  1203. if @text != nil and not @text.empty?
  1204. new_page if @line_count >= $game_message.max_line
  1205. else
  1206. terminate_message
  1207. end
  1208. end
  1209. end
  1210. #--------------------------------------------------------------------------
  1211. # ? ????????
  1212. #--------------------------------------------------------------------------
  1213. def input_choice
  1214. if Input.trigger?(Input::B)
  1215. if $game_message.choice_cancel_type > 0
  1216. Sound.play_cancel
  1217. $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  1218. terminate_message
  1219. end
  1220. elsif Input.trigger?(Input::C)
  1221. Sound.play_decision
  1222. $game_message.choice_proc.call(self.index)
  1223. terminate_message
  1224. end
  1225. end
  1226. #--------------------------------------------------------------------------
  1227. # ? ???????
  1228. #--------------------------------------------------------------------------
  1229. def input_number
  1230. if Input.trigger?(Input::C)
  1231. Sound.play_decision
  1232. $game_variables[$game_message.num_input_variable_id] =
  1233. @number_input_window.number
  1234. $game_map.need_refresh = true
  1235. terminate_message
  1236. end
  1237. end
  1238. end
  1239.  
  1240. #==============================================================================
  1241. # NMS +[ADD ON]+ WINDOW_MESSAGE_CLASS
  1242. #------------------------------------------------------------------------------
  1243. #==============================================================================
  1244.  
  1245. class Window_Message < Window_Selectable
  1246.  
  1247. # Return X for Text
  1248. def get_x_face
  1249. if MOVE_TEXT == true
  1250. case $game_message.side
  1251. when 0
  1252. return 112 + TEXT_X_PLUS
  1253. when 1
  1254. return text_x
  1255. when 2
  1256. return TEXT_X_PLUS
  1257. else
  1258. return TEXT_X_PLUS
  1259. end
  1260. else
  1261. return TEXT_X_PLUS
  1262. end
  1263. end
  1264.  
  1265. def text_x
  1266. return @face.width + TEXT_X_PLUS
  1267. end
  1268.  
  1269. # Clear Name Box & Name Text
  1270. def clear_namebox
  1271. @nametxt.bitmap.dispose
  1272. @namebox.dispose
  1273. @namebox = nil
  1274. @name_text = nil
  1275. end
  1276.  
  1277. def nms_get_map_name
  1278. mapdata = load_data("Data/MapInfos.rvdata")
  1279. map_id = $game_map.map_id
  1280. return mapdata[map_id].name
  1281. end
  1282.  
  1283. #--------------------------------------
  1284. # DRAW FACE [Both Systems] METHOD
  1285. #------------------------------------
  1286. def draw_face2(face_name, x, y, index = 0, animf = false, animf_index = 0, animf_max = 1, nofade = false)
  1287. if animf
  1288. # Use Animated Face
  1289. bitmap = Cache.face(face_name)
  1290. rect = Rect.new(0,0,0,0)
  1291. rect.width = (bitmap.width / animf_max)
  1292. rect.height = bitmap.height
  1293. rect.x = animf_index * rect.width
  1294. rect.y = 0
  1295. @face.bitmap = Bitmap.new(rect.width,rect.height)
  1296. @face.bitmap.blt(0,0,bitmap,rect)
  1297. bitmap.dispose
  1298. elsif $game_message.side == 0 or $game_message.side == -1 or EightFaces_File
  1299. # USE 8 FACES PER FILE
  1300. bitmap = Cache.face(face_name)
  1301. rect = Rect.new(0,0,0,0)
  1302. rect.width = (bitmap.width / 4)
  1303. rect.height = (bitmap.height / 2)
  1304. rect.x = index % 4 * rect.width
  1305. rect.y = index / 4 * rect.height
  1306. @face.bitmap = Bitmap.new(rect.width,rect.height)
  1307. @face.bitmap.blt(0,0,bitmap,rect)
  1308. bitmap.dispose
  1309. else
  1310. # USE 1 FACES PER FILE
  1311. @face.bitmap = Cache.face(face_name)
  1312. end
  1313. # SET X/Y OF FACE DEPENDS ON FACE SIDE
  1314. if $game_message.side == 1
  1315. @face.mirror = false
  1316. @face.x = x + 6
  1317. @face.y = y - 6 + height - @face.height
  1318. elsif $game_message.side == 2
  1319. @face.mirror = true
  1320. @face.x = x + ((self.width - 6) - @face.width)
  1321. @face.y = y - 6 + height - @face.height
  1322. elsif $game_message.side == 0
  1323. @face.mirror = false
  1324. @face.x = x + 16
  1325. @face.y = y - 16 + height - @face.height
  1326. elsif $game_message.side == -1
  1327. @face.mirror = true
  1328. @face.x = x + self.contents.width - @face.width + 16
  1329. @face.y = y - 16 + height - @face.height
  1330. end
  1331. @face.x += FACE_X_PLUS
  1332. @face.y += FACE_Y_PLUS
  1333. @face_data = [face_name, index, $game_message.side]
  1334. if @face_data != @face_data_old and FADE_MOVE_WHEN_USE_NEW_FACE; @showtime = 1; @face_data_old = @face_data; end
  1335. @face.opacity = 0 if !nofade and ($nms.face_fade == true and ((FADE_ONLY_FIRST and @showtime <= 1) or (FADE_ONLY_FIRST == false)))
  1336. end
  1337. #--------------------------------------
  1338. # DRAW NAME BOX METHOD
  1339. #-----------------------------------
  1340. def draw_name(name,x,y)
  1341. name = name + NAMEBOX_TEXT_AFTER_NAME
  1342. a = Bitmap.new(33,33)
  1343. a.font.name = NAMEBOX_TEXT_FONT
  1344. a.font.size = NAMEBOX_TEXT_SIZE
  1345. rect = a.text_size(name)
  1346. a.dispose
  1347. @nametxt.bitmap = Bitmap.new(16 + rect.width, rect.height + NAMEBOX_TEXT_HEIGHT_PLUS)
  1348. @nametxt.x = x + 8
  1349. if $game_message.side == 1 or $game_message.side == 2
  1350. @nametxt.x += NAMEBOX_X_PLUS_NEO
  1351. else
  1352. @nametxt.x += NAMEBOX_X_PLUS_NOR
  1353. end
  1354. @nametxt.y = y - 20 + ($game_message.position == 0 ? NAMEBOX_Y_PLUS_TOP : NAMEBOX_Y_PLUS)
  1355. namebox_x_plus = ($game_message.side == 1 or $game_message.side == 2) ? NAMEBOX_X_PLUS_NEO : NAMEBOX_X_PLUS_NOR
  1356. @nametxt.x = ((self.x + $nms.msg_w) - namebox_x_plus - @nametxt.width) if MOVE_NAMEBOX and ($game_message.side == 2 or $game_message.side == -1)
  1357. @namebox = Window.new
  1358. @namebox.windowskin = Cache.system(NAMEBOX_SKIN)
  1359. @namebox.z = self.z + 10
  1360. @namebox.opacity = case @background
  1361. when 0; NAMEBOX_OPACITY
  1362. when 1; NAMEBOX_OPACITY_DIM_BG
  1363. when 2; NAMEBOX_OPACITY_NO_BG
  1364. end
  1365. @namebox.back_opacity = NAMEBOX_BACK_OPACITY
  1366. @namebox.openness = 255
  1367. @namebox.x = @nametxt.x - NAMEBOX_BOX_WIDTH_PLUS
  1368. @namebox.y = @nametxt.y - NAMEBOX_BOX_HEIGHT_PLUS
  1369. @namebox.width = @nametxt.bitmap.width + (NAMEBOX_BOX_WIDTH_PLUS * 2)
  1370. @namebox.height = @nametxt.bitmap.height + (NAMEBOX_BOX_HEIGHT_PLUS * 2)
  1371. # Fixed position bug
  1372. @namebox.x = 0 if @namebox.x < 0
  1373. @namebox.x = (Graphics.width - @namebox.width) if (@namebox.x + @namebox.width) > Graphics.width
  1374. @nametxt.bitmap.font.name = NAMEBOX_TEXT_FONT
  1375. @nametxt.bitmap.font.size = NAMEBOX_TEXT_SIZE
  1376. @nametxt.bitmap.font.bold = NAMEBOX_TEXT_BOLD
  1377. if NAMEBOX_TEXT_OUTLINE == true
  1378. # MAKE TEXT OUTLINE
  1379. old_shadow = @nametxt.bitmap.font.shadow
  1380. @nametxt.bitmap.font.color = Color.new(0,0,0)
  1381. @nametxt.bitmap.draw_text(0,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
  1382. @nametxt.bitmap.draw_text(0,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
  1383. @nametxt.bitmap.draw_text(2,0,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
  1384. @nametxt.bitmap.draw_text(2,2,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
  1385. @nametxt.bitmap.font.shadow = old_shadow
  1386. end
  1387. @nametxt.bitmap.font.color = Color.new($game_message.color[0],$game_message.color[1],$game_message.color[2])
  1388. @nametxt.bitmap.draw_text(1,1,@nametxt.bitmap.width,@nametxt.bitmap.height,name,1)
  1389. @name_text = nil
  1390. end
  1391.  
  1392. #--------------------------------------
  1393. # DRAW NEW FACE
  1394. #-----------------------------------
  1395. def nms_draw_new_face
  1396. # Setup Face Name / Index
  1397. name = $game_message.face_name
  1398. index = $game_message.face_index
  1399. animf_test = name.sub(/\[([0-9]+)\]/, "")
  1400. # Animated?
  1401. @animf = $1.to_i > 0 ? true : false
  1402. @animf_maxind = $1.to_i
  1403. @animf_ind = 0
  1404. @animf_dl = $nms.animf_delay
  1405. # CALL DRAW FACE METHOD
  1406. draw_face2(name, self.x, self.y, index, @animf, @animf_ind, @animf_maxind)
  1407. end
  1408. #--------------------------------------
  1409. # UPDATE ANIMATION FACE
  1410. #-----------------------------------
  1411. def update_animate_face
  1412. if (!self.pause or $nms.animf_cont)
  1413. @animf_dl -= 1
  1414. if @animf_dl <= 0
  1415. @animf_ind = (@animf_ind + 1) % @animf_maxind
  1416. @animf_dl = $nms.animf_delay
  1417. draw_face2($game_message.face_name, self.x, self.y, index, @animf, @animf_ind, @animf_maxind, true)
  1418. end
  1419. elsif @animf_ind != 0
  1420. @animf_ind = 0
  1421. draw_face2($game_message.face_name, self.x, self.y, index, @animf, @animf_ind, @animf_maxind, true)
  1422. end
  1423. end
  1424. #--------------------------------------
  1425. # SCROLL TEXT HORIZONTAL
  1426. #-----------------------------------
  1427. def nms_scroll_hori(scr_width)
  1428. biggest = @biggest_text_height > WLH ? @biggest_text_height : WLH
  1429. rect = Rect.new(0, @contents_y, contents.width, biggest)
  1430. bitmap = Bitmap.new(rect.width, rect.height)
  1431. bitmap.blt(0, 0, contents, rect)
  1432. contents.clear_rect(rect)
  1433. rect = Rect.new(0, 0, rect.width, rect.height)
  1434. contents.blt(0 - scr_width, @contents_y, bitmap, rect)
  1435. contents.clear_rect(0, 0, @face.width, @face.height) if @face.bitmap != nil
  1436. bitmap.dispose
  1437. @contents_x = @contents_x - scr_width
  1438. end
  1439.  
  1440. #--------------------------------------
  1441. # GET HEX COLOR by RPG & ERZENGEL
  1442. #------------------------------------
  1443. def get_hex(n)
  1444. red = 0
  1445. green = 0
  1446. blue = 0
  1447. if n.size != 6
  1448. print("Hex triplets must be six characters long!\nNormal color will be used.")
  1449. return normal_color
  1450. end
  1451. for i in 1..6
  1452. sliced = n.slice!(/./m)
  1453. value = hexconvert(sliced)
  1454. case i
  1455. when 1; red += value * 16
  1456. when 2; red += value
  1457. when 3; green += value * 16
  1458. when 4; green += value
  1459. when 5; blue += value * 16
  1460. when 6; blue += value
  1461. end
  1462. end
  1463. return Color.new(red, green, blue)
  1464. end
  1465. def hexconvert(n)
  1466. case n
  1467. when "0"; return 0
  1468. when "1"; return 1
  1469. when "2"; return 2
  1470. when "3"; return 3
  1471. when "4"; return 4
  1472. when "5"; return 5
  1473. when "6"; return 6
  1474. when "7"; return 7
  1475. when "8"; return 8
  1476. when "9"; return 9
  1477. when "A"; return 10
  1478. when "B"; return 11
  1479. when "C"; return 12
  1480. when "D"; return 13
  1481. when "E"; return 14
  1482. when "F";return 15
  1483. else; return -1
  1484. end
  1485. end
  1486. end # CLASS END
  1487.  
  1488. #==============================================================================
  1489. # NMS +[ADD ON]+ OTHER CLASS
  1490. #------------------------------------------------------------------------------
  1491. #==============================================================================
  1492.  
  1493. # STORE variables here~*
  1494. class Game_Message
  1495. attr_accessor :nms_fontname, :nms_fontsize, :event_id, :side, :color, :_name,
  1496. :last_color, :text_delay, :lbl, :msg_w, :msg_h, :msg_x, :max_line, :nms_face_name,
  1497. :nms_face_index, :next_msg, :typ_se, :typ_file, :typ_skip, :typ_vol, :mback, :mback_opac,
  1498. :qt, :txt_scrl, :msg_h_user, :animf_delay, :animf_cont, :txt_cut, :txt_unl, :txt_scrl_hori,
  1499. :txt_scrl_hori_delay, :face_fade, :face_move, :msg_temp_y, :msg_temp_x, :msg_temp_h,
  1500. :msg_temp_w
  1501.  
  1502.  
  1503. alias wor_nms_old_ini initialize
  1504. def initialize
  1505. create_nms_data
  1506. wor_nms_old_ini
  1507. end
  1508.  
  1509. def create_nms_data
  1510. # NFS
  1511. @side = Window_Base::DEFAULT_FACE_SIDE
  1512. @_name = ""
  1513. @color = Window_Base::NAMEBOX_TEXT_DEFAULT_COLOR
  1514. # NMS
  1515. @last_color = 0
  1516. @nms_fontname = Window_Base::NMS_FONT_NAME
  1517. @nms_fontsize = Window_Base::NMS_FONT_SIZE
  1518. @event_id = 0
  1519. @text_delay = Window_Base::NMS_DELAY_PER_LETTER
  1520. @lbl = true
  1521. @msg_w = Window_Base::NMS_MSGWIN_WIDTH
  1522. @msg_h = @msg_h_user = Window_Base::NMS_MSGWIN_MIN_HEIGHT
  1523. @msg_x = Window_Base::NMS_MSGWIN_X
  1524. @max_line = Window_Base::NMS_MAX_LINE
  1525. @nms_face_name = ""
  1526. @nms_face_index = 1
  1527. @next_msg = false
  1528. @typ_se = Window_Base::TYPING_SOUND
  1529. @typ_file = Window_Base::TYPING_SOUND_FILE
  1530. @typ_skip = Window_Base::TYPING_SOUND_SKIP
  1531. @typ_vol = Window_Base::TYPING_SOUND_VOLUME
  1532. @mback = Window_Base::NMS_MSG_BACK
  1533. @mback_opac = Window_Base::NMS_MSG_BACK_OPACITY
  1534. @qt = Array.new
  1535. @txt_scrl = Window_Base::NMS_TEXT_SCROLL
  1536. @animf_delay = Window_Base::ANIMATE_FACE_DELAY
  1537. @animf_cont = Window_Base::ANIMATE_FACE_CONTINUE
  1538. @txt_cut = Window_Base::NMS_TEXT_AUTO_CUT
  1539. @txt_scrl_hori = Window_Base::NMS_TEXT_AUTO_SCROLL_HORIZONTAL
  1540. @txt_scrl_hori_delay = Window_Base::NMS_TEXT_AUTO_SCROLL_HORIZONTAL_DELAY
  1541. @txt_unl = Window_Base::NMS_USER_NEW_LINE
  1542. @face_fade = Window_Base::FADE_EFFECT
  1543. @face_move = Window_Base::MOVE_EFFECT
  1544. @msg_temp_x = nil
  1545. @msg_temp_y = nil
  1546. @msg_temp_h = nil
  1547. @msg_temp_w = nil
  1548. end
  1549. end
  1550.  
  1551. class Game_Map
  1552. attr_accessor :interpreter
  1553. end
  1554.  
  1555. class Game_Interpreter
  1556. attr_accessor :params
  1557. end
  1558.  
  1559. class Game_Interpreter
  1560. def command_101
  1561. unless $game_message.busy
  1562. $game_message.event_id = @event_id
  1563. $game_message.face_name = @params[0]
  1564. $game_message.face_index = @params[1]
  1565. $game_message.background = @params[2]
  1566. $game_message.position = @params[3]
  1567. next_msg = true
  1568. loop do
  1569. if @list[@index].code == 101 and $game_message.max_line > $game_message.texts.size and next_msg
  1570. @index += 1
  1571. else
  1572. break
  1573. end
  1574. next_msg = false
  1575. while @list[@index].code == 401 and $game_message.max_line > $game_message.texts.size
  1576. next_msg = $game_message.next_msg
  1577. $game_message.texts.push(@list[@index].parameters[0])
  1578. @index += 1
  1579. end
  1580. end
  1581. if @list[@index].code == 102
  1582. setup_choices(@list[@index].parameters)
  1583. elsif @list[@index].code == 103
  1584. setup_num_input(@list[@index].parameters)
  1585. end
  1586. set_message_waiting
  1587. end
  1588. return false
  1589. end
  1590.  
  1591. def setup_choices(params)
  1592. if $game_message.texts.size <= $game_message.max_line - params[0].size
  1593. $game_message.choice_start = $game_message.texts.size
  1594. $game_message.choice_max = params[0].size
  1595. for s in params[0]
  1596. $game_message.texts.push(s)
  1597. end
  1598. $game_message.choice_cancel_type = params[1]
  1599. $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
  1600. @index += 1
  1601. end
  1602. end
  1603. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement