Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.97 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # Yanfly 6 - Help Window Advanced
  4. # --- Last Date Updated: 2011.11.09
  5. # --- Level: Normal, Lunatic
  6. # Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported == nil
  11. $imported["Y6-HelpWindowAdvanced"] = true
  12.  
  13. #==============================================================================
  14. # Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # o 2011.11.09 - Bugfix regarding \n[x].
  17. # o 2011.11.03 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # This script gives you the ability to expand the help window's number of lines
  23. # up to a maximum of 4 times. You will be able to use unique text codes in your
  24. # help descriptions to change text colour, font, place in icons, and more.
  25. #
  26. # This script also contains Lunatic Mode for those who wish to have custom
  27. # descriptions that vary for items and skills.
  28. #
  29. #==============================================================================
  30. # Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ¥ Materials but above ¥ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Help Window REGEXP Codes - These go inside of your help description.
  37. # -----------------------------------------------------------------------------
  38. # Code: Effect:
  39. # \v[x] Writes variable x's value.
  40. # \n[x] Writes actor x's name.
  41. # \c[x] Changes the colour of the text to x.
  42. #
  43. # | Line break.
  44. #
  45. # \fn[x] Changes the font name to x. Set to 0 to reset font name.
  46. # \fs[x] Changes the font size to x. Set to 0 to reset font size.
  47. # \fb Changes the font to bold and back.
  48. # \fi Changes the font to italic
  49. # \fh Changes the font to shadowed and back.
  50. #
  51. # \i[x] Draws icon ID x into the message window.
  52. # \ii[x] Writes item ID x's name with icon included.
  53. # \iw[x] Writes weapon ID x's name with icon included.
  54. # \ia[x] Writes armour ID x's name with icon included.
  55. # \is[x] Writes skill ID x's name with icon included.
  56. # \it[x] Writes state ID x's name with icon included.
  57. #
  58. # \nc[x] Writes class ID x's name.
  59. # \ni[x] Writes item ID x's name.
  60. # \nw[x] Writes weapon ID x's name.
  61. # \na[x] Writes armour ID x's name.
  62. # \ns[x] Writes skill ID x's name.
  63. # \nt[x] Writes state ID x's name.
  64. #
  65. # \X[x] Custom conversion code used for Lunatic Mode.
  66. # \X[x:y] Custom conversion code used for Lunatic Mode.
  67. # \X[x:y:z] Custom conversion code used for Lunatic Mode.
  68. #
  69. #==============================================================================
  70. # Compatibility
  71. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # Note: This script may not work with former Yanfly Engine scripts.
  73. # Use Yanfly Engine 6 scripts to work with this if available.
  74. #==============================================================================
  75.  
  76. module Y6
  77. module HELP
  78.  
  79. #--------------------------------------------------------------------------
  80. # - Help Window Settings -
  81. #--------------------------------------------------------------------------
  82. # Here, you can adjust the basic settings that govern all the help windows
  83. # found in the game such as the number of lines it has, the font size, etc.
  84. #--------------------------------------------------------------------------
  85. LINES = 2 # Maximum lines is 4. Minimum is 1.
  86. FONT_SIZE = 22 # Original default font size is 20.
  87. FONT_NAME = ["Janda Manatee Solid"]
  88.  
  89. # Depending on whether or not you have custom scene scripts, you can choose
  90. # whether or not you want certain scenes to be automatically modified via
  91. # this script.
  92. FIX_SCENE_ITEM = true
  93. FIX_SCENE_SKILL = true
  94. FIX_SCENE_EQUIP = true
  95. FIX_SCENE_FILE = true # This will revert Help_Window to 1 line.
  96.  
  97. # This part adjusts the help window for what windows use the help window
  98. # in the default battle scene. This does not adjust the windows for custom
  99. # battle scripts. For custom battle scripts, you will need to manually
  100. # adjust them to fit in an expanded help window.
  101. FIX_BATTLE_ITEM = true
  102. FIX_BATTLE_SKILL = true
  103.  
  104. # This adjusts the text that appears when \N[0] is used in a scene without
  105. # an active battler or in a scene that is unsupported by the Help Window.
  106. N0_NAME = "User"
  107.  
  108. end # HELP
  109. end # Y6
  110.  
  111. #==============================================================================
  112. # Lunatic Mode - Custom Message System
  113. #==============================================================================
  114. #
  115. # This portion is for those who know how to script and would like to use
  116. # various tags to produce easy Lunatic Mode shortcuts.
  117. #
  118. # \X[x] or \X[x:y] or \X[x:y:z]
  119. # These let you create your own custom tags. If you use the first tag, there is
  120. # one case for the "custom_convert" definition to return. If you use the second
  121. # tag, there will be two cases for you to select from. And likewise, if there's
  122. # three tags, then the z case will also be taken into account of.
  123. #
  124. #==============================================================================
  125.  
  126. class Window_Help < Window_Base
  127.  
  128. #--------------------------------------------------------------------------
  129. # new method: custom_convert
  130. #--------------------------------------------------------------------------
  131. def custom_convert(x_case, y_case = 0, z_case = 0)
  132. text = ""
  133. case x_case
  134. #----------------------------------------------------------------------
  135. # Start editting here.
  136. #----------------------------------------------------------------------
  137. when 1 # Show the full name of the actor.
  138. case y_case # This is the extra case for the actor.
  139. when 1
  140. text = "\\n[1] von Xiguel"
  141. when 2
  142. text = "Michelle \\n[2]"
  143. when 3
  144. text = "\\n[3] Manfred"
  145. when 4
  146. text = "\\n[4] Fernaeus"
  147. end
  148.  
  149. when 2 # Llama Sagrada
  150. n = 30 + $game_actors[1].level
  151. text = n.to_i
  152.  
  153. when 3 # Llama Sagrada2
  154. n = $game_actors[1].level * 2
  155. text = n.to_i
  156.  
  157. when 4 # Sanación
  158. n = $game_actors[1].level
  159. text = n.to_i
  160.  
  161. when 5 # Plegaria
  162. n = $game_actors[1].mp + $game_actors[1].level
  163. text = n.to_i
  164.  
  165. when 6 # Manos Benditas y Ola Curativa
  166. n = $game_actors[1].level * 2
  167. text = n.to_i
  168.  
  169. when 7 # Augurio
  170. n = $game_actors[4].level unless $game_actors[4].level < 10
  171. n = 10 if $game_actors[4].level < 10
  172. text = n.to_i
  173.  
  174. when 8 # Augurio2
  175. n = $game_actors[4].maxhp - $game_actors[4].level * 15
  176. text = n.to_i
  177.  
  178. when 9 # Dolor Inverso
  179. n = $game_actors[4].maxhp - $game_actors[4].hp
  180. text = n.to_i
  181.  
  182. when 10 # Mal Presagio
  183. n = $game_actors[4].level * 2
  184. text = n.to_i
  185.  
  186. when 11 # Baquía
  187. n = $game_actors[3].level / 2
  188. text = n.to_i
  189.  
  190. when 12 # Impacto Firme
  191. n = $game_actors[5].level * 2
  192. text = n.to_i
  193.  
  194. when 13 # Garra Letal
  195. n = $game_actors[6].rage * 10 unless $game_actors[6].rage == 0
  196. n = 0 if $game_actors[6].rage == 0
  197. text = n.to_i
  198.  
  199. when 14 # Recuperación
  200. n = $game_actors[6].atk * $game_actors[6].rage unless $game_actors[6].rage == 0
  201. n = $game_actors[6].atk if $game_actors[6].rage == 0
  202. text = n.to_i
  203.  
  204. when 15 # Simbiosis
  205. n = 10 + $game_actors[6].rage * 2
  206. text = n.to_i
  207. #----------------------------------------------------------------------
  208. # Stop editting past this point.
  209. #----------------------------------------------------------------------
  210. end
  211. return text
  212. end
  213.  
  214. end # Window_Help
  215.  
  216. #==============================================================================
  217. # Editting anything past this point may potentially result in causing computer
  218. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis
  219. # so edit at your own risk.
  220. #==============================================================================
  221.  
  222. #==============================================================================
  223. # ** Scene_Item
  224. #==============================================================================
  225.  
  226. class Scene_Item < Scene_Base
  227.  
  228. if Y6::HELP::FIX_SCENE_ITEM
  229. #--------------------------------------------------------------------------
  230. # alias method: start
  231. #--------------------------------------------------------------------------
  232. alias scene_item_start_hwa start unless $@
  233. def start
  234. scene_item_start_hwa
  235. adjust_hwa
  236. end
  237.  
  238. #--------------------------------------------------------------------------
  239. # new method: adjust_hwa
  240. #--------------------------------------------------------------------------
  241. def adjust_hwa
  242. @item_window.height = Graphics.height - @help_window.height
  243. @item_window.y = @help_window.height + @help_window.y
  244. @item_window.refresh
  245. end
  246. end # Y6::HELP::FIX_SCENE_ITEM
  247.  
  248. end # Scene_Item
  249.  
  250. #==============================================================================
  251. # ** Scene_Skill
  252. #==============================================================================
  253.  
  254. class Scene_Skill < Scene_Base
  255.  
  256. #--------------------------------------------------------------------------
  257. # public instance variables
  258. #--------------------------------------------------------------------------
  259. attr_accessor :actor
  260.  
  261. if Y6::HELP::FIX_SCENE_SKILL
  262. #--------------------------------------------------------------------------
  263. # alias method: start
  264. #--------------------------------------------------------------------------
  265. alias scene_skill_start_hwa start unless $@
  266. def start
  267. scene_skill_start_hwa
  268. adjust_hwa
  269. end
  270.  
  271. #--------------------------------------------------------------------------
  272. # new method: adjust_hwa
  273. #--------------------------------------------------------------------------
  274. def adjust_hwa
  275. @skill_window.height = Graphics.height - @help_window.height - 56
  276. @status_window.y = @help_window.height + @help_window.y
  277. @skill_window.y = @help_window.height + @help_window.y + 56
  278. @skill_window.refresh
  279. end
  280. end # Y6::HELP::FIX_SCENE_SKILL
  281.  
  282. end # Scene_Skill
  283.  
  284. #==============================================================================
  285. # ** Scene_Equip
  286. #==============================================================================
  287.  
  288. class Scene_Equip < Scene_Base
  289.  
  290. #--------------------------------------------------------------------------
  291. # public instance variables
  292. #--------------------------------------------------------------------------
  293. attr_accessor :actor
  294.  
  295. if Y6::HELP::FIX_SCENE_EQUIP
  296. #--------------------------------------------------------------------------
  297. # alias method: start
  298. #--------------------------------------------------------------------------
  299. alias scene_equip_start_hwa start unless $@
  300. def start
  301. scene_equip_start_hwa
  302. adjust_hwa
  303. end
  304.  
  305. #--------------------------------------------------------------------------
  306. # new method: adjust_hwa
  307. #--------------------------------------------------------------------------
  308. def adjust_hwa
  309. @equip_window.y = @help_window.height + @help_window.y
  310. @status_window.y = @help_window.height + @help_window.y
  311. for i in 0...EQUIP_TYPE_MAX
  312. @item_windows[i].height = Graphics.height - @help_window.height
  313. @item_windows[i].height -= @status_window.height
  314. @item_windows[i].refresh
  315. @item_windows[i].y = @help_window.height + @help_window.y
  316. @item_windows[i].y += @equip_window.height
  317. end
  318. end
  319. end # Y6::HELP::FIX_SCENE_EQUIP
  320.  
  321. end # Scene_Skill
  322.  
  323. #==============================================================================
  324. # ** Scene_File
  325. #==============================================================================
  326.  
  327. class Scene_File < Scene_Base
  328.  
  329. if Y6::HELP::FIX_SCENE_FILE
  330. #--------------------------------------------------------------------------
  331. # alias method: start
  332. #--------------------------------------------------------------------------
  333. alias scene_file_start_hwa start unless $@
  334. def start
  335. scene_file_start_hwa
  336. adjust_hwa
  337. end
  338.  
  339. #--------------------------------------------------------------------------
  340. # new method: adjust_hwa
  341. #--------------------------------------------------------------------------
  342. def adjust_hwa
  343. @help_window.height = 56
  344. @help_window.create_contents
  345. @help_window.set_text("")
  346. if @saving
  347. @help_window.set_text(Vocab::SaveMessage)
  348. else
  349. @help_window.set_text(Vocab::LoadMessage)
  350. end
  351. end
  352. end # Y6::HELP::FIX_SCENE_FILE
  353.  
  354. end # Scene_File
  355.  
  356. #==============================================================================
  357. # ** Scene_Battle
  358. #==============================================================================
  359.  
  360. class Scene_Battle < Scene_Base
  361.  
  362. #--------------------------------------------------------------------------
  363. # public instance variables
  364. #--------------------------------------------------------------------------
  365. attr_accessor :active_battler
  366.  
  367. if Y6::HELP::FIX_BATTLE_ITEM
  368. #--------------------------------------------------------------------------
  369. # alias method: start_item_selection
  370. #--------------------------------------------------------------------------
  371. alias start_item_selection_battle_hwa start_item_selection unless $@
  372. def start_item_selection
  373. start_item_selection_battle_hwa
  374. adjust_hwa_battle_item
  375. end
  376. #--------------------------------------------------------------------------
  377. # new method: adjust_hwa_battle_item
  378. #--------------------------------------------------------------------------
  379. def adjust_hwa_battle_item
  380. @item_window.height = Graphics.height - @help_window.height - 128
  381. @item_window.y = @help_window.height + @help_window.y
  382. @item_window.refresh
  383. end
  384. end # Y6::HELP::FIX_BATTLE_ITEM
  385.  
  386. if Y6::HELP::FIX_BATTLE_SKILL
  387. #--------------------------------------------------------------------------
  388. # alias method: start_skill_selection
  389. #--------------------------------------------------------------------------
  390. alias start_skill_selection_battle_hwa start_skill_selection unless $@
  391. def start_skill_selection
  392. start_skill_selection_battle_hwa
  393. adjust_hwa_battle_skill
  394. end
  395.  
  396. #--------------------------------------------------------------------------
  397. # new method: adjust_hwa_battle_skill
  398. #--------------------------------------------------------------------------
  399. def adjust_hwa_battle_skill
  400. @skill_window.height = Graphics.height - @help_window.height - 128
  401. @skill_window.y = @help_window.height + @help_window.y
  402. @skill_window.refresh
  403. end
  404. end # Y6::HELP::FIX_BATTLE_SKILL
  405.  
  406. end # Scene_Battle
  407.  
  408. #==============================================================================
  409. # ** Window_Help
  410. #==============================================================================
  411.  
  412. class Window_Help < Window_Base
  413.  
  414. #--------------------------------------------------------------------------
  415. # overwrite method: initialize
  416. #--------------------------------------------------------------------------
  417. def initialize
  418. dw = Graphics.width
  419. dh = 32 + WLH * [[Y6::HELP::LINES, 1].max, 4].min
  420. super(0, 0, dw, dh)
  421. end
  422.  
  423. #--------------------------------------------------------------------------
  424. # overwrite method: set_text
  425. #--------------------------------------------------------------------------
  426. def set_text(text, align = 0)
  427. test = short_convert(text.clone)
  428. return unless test != @test or align != @align
  429. @test = test
  430. text = convert_special_characters(text.clone)
  431. @text = text
  432. @align = align
  433. contents.font.size = Y6::HELP::FONT_SIZE
  434. #---
  435. contents.clear
  436. contents.font.name = Y6::HELP::FONT_NAME
  437. contents.font.color = normal_color
  438. produce_contents
  439. end
  440.  
  441. #--------------------------------------------------------------------------
  442. # new method: short_convert
  443. #--------------------------------------------------------------------------
  444. def short_convert(text)
  445. text.gsub!(/\\X\[(\d+)\]/i) {
  446. custom_convert($1.to_i) }
  447. text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
  448. custom_convert($1.to_i, $2.to_i) }
  449. text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
  450. custom_convert($1.to_i, $2.to_i, $3.to_i) }
  451. text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
  452. text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
  453. text.gsub!(/\\N\[0\]/i) { current_actor }
  454. text.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
  455. return text
  456. end
  457.  
  458. #--------------------------------------------------------------------------
  459. # new method: convert_special_characters
  460. #--------------------------------------------------------------------------
  461. def convert_special_characters(text)
  462. text.gsub!(/\\X\[(\d+)\]/i) {
  463. custom_convert($1.to_i) }
  464. text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
  465. custom_convert($1.to_i, $2.to_i) }
  466. text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
  467. custom_convert($1.to_i, $2.to_i, $3.to_i) }
  468. #------------------------------------------------------------------------
  469. text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
  470. text.gsub!(/\\V\[(\d+)\]/i) { $game_variables[$1.to_i] }
  471. text.gsub!(/\\N\[0\]/i) { current_actor }
  472. text.gsub!(/\\N\[(\d+)\]/i) { $game_actors[$1.to_i].name }
  473. text.gsub!(/\\C\[(\d+)\]/i) { "\x01{#{$1}}" }
  474. text.gsub!(/\\I\[(\d+)\]/i) { "\x10{#{$1}}" }
  475. #------------------------------------------------------------------------
  476. text.gsub!(/\\FS\[(\d+)\]/i) { "\x11{#{$1}}" }
  477. text.gsub!(/\\FN\[(.*?)\]/i) { "\x12{#{$1}}" }
  478. text.gsub!(/\\FB/i) { "\x13" }
  479. text.gsub!(/\\FI/i) { "\x14" }
  480. text.gsub!(/\\FH/i) { "\x15" }
  481. #------------------------------------------------------------------------
  482. text.gsub!(/\\NC\[(\d+)\]/i) {
  483. $data_classes[$1.to_i].name }
  484. text.gsub!(/\\NI\[(\d+)\]/i) {
  485. $data_items[$1.to_i].name }
  486. text.gsub!(/\\NW\[(\d+)\]/i) {
  487. $data_weapons[$1.to_i].name }
  488. text.gsub!(/\\NA\[(\d+)\]/i) {
  489. $data_armors[$1.to_i].name }
  490. text.gsub!(/\\NS\[(\d+)\]/i) {
  491. $data_skills[$1.to_i].name }
  492. text.gsub!(/\\NT\[(\d+)\]/i) {
  493. $data_states[$1.to_i].name }
  494. text.gsub!(/\\II\[(\d+)\]/i) {
  495. "\x10{#{$data_items[$1.to_i].icon_index}}" +
  496. "#{$data_items[$1.to_i].name}"}
  497. text.gsub!(/\\IW\[(\d+)\]/i) {
  498. "\x10{#{$data_weapons[$1.to_i].icon_index}}" +
  499. "#{$data_weapons[$1.to_i].name}"}
  500. text.gsub!(/\\IA\[(\d+)\]/i) {
  501. "\x10{#{$data_armors[$1.to_i].icon_index}}" +
  502. "#{$data_armors[$1.to_i].name}"}
  503. text.gsub!(/\\IS\[(\d+)\]/i) {
  504. "\x10{#{$data_skills[$1.to_i].icon_index}}" +
  505. "#{$data_skills[$1.to_i].name}"}
  506. text.gsub!(/\\IT\[(\d+)\]/i) {
  507. "\x10{#{$data_states[$1.to_i].icon_index}}" +
  508. "#{$data_states[$1.to_i].name}"}
  509. #------------------------------------------------------------------------
  510. return text
  511. end
  512.  
  513. #--------------------------------------------------------------------------
  514. # new method: current_actor
  515. #--------------------------------------------------------------------------
  516. def current_actor
  517. if $scene.is_a?(Scene_Skill) or $scene.is_a?(Scene_Equip)
  518. return $scene.actor.name
  519. elsif $scene.is_a?(Scene_Battle) and $scene.active_battler != nil
  520. return $scene.active_battler.name
  521. else
  522. return Y6::HELP::N0_NAME
  523. end
  524. end
  525.  
  526. #--------------------------------------------------------------------------
  527. # new method: produce_contents
  528. #--------------------------------------------------------------------------
  529. def produce_contents
  530. @contents_x = 0
  531. @contents_y = 0
  532. loop do
  533. c = @text.slice!(/./m)
  534. case c
  535. #----------------------------------------------------------------------
  536. # Code Settings
  537. #----------------------------------------------------------------------
  538. when nil
  539. break
  540. when "|"
  541. @contents_y += WLH
  542. @contents_x = 0
  543. when "\x01" # \C[n] (text character color change)
  544. @text.sub!(/\{(\d+)\}/, "")
  545. contents.font.color = text_color($1.to_i)
  546. when "\x10" # \i Draws icon ID x
  547. @text.sub!(/\{(\d+)\}/, "")
  548. draw_icon($1.to_i, @contents_x, @contents_y)
  549. @contents_x += 24
  550. when "\x11" # \fs Font Size Change
  551. @text.sub!(/\{(\d+)\}/, "")
  552. size = $1.to_i
  553. if size <= 0 # If 0, revert back to the default font size.
  554. size = Y6::HELP::FONT_SIZE
  555. end
  556. contents.font.size = size
  557. text_height = [size + (size / 5), WLH].max
  558. when "\x12" # \fs Font Name Change
  559. @text.sub!(/\{(.*?)\}/, "")
  560. name = $1.to_s
  561. if name == "0" # If 0, revert back to the default font.
  562. name = Y6::HELP::FONT_NAME
  563. end
  564. contents.font.name = name
  565. else
  566. contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
  567. @contents_x += contents.text_size(c).width
  568. end
  569. end
  570. end
  571.  
  572. end # Window_Help
  573.  
  574. #===============================================================================
  575. #
  576. # END OF FILE
  577. #
  578. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement