Advertisement
WCouillard

RGSS3: Menu Battle Member Restriction 1.01

Dec 4th, 2014
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 14.11 KB | None | 0 0
  1. # ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
  2. # ║ Menu Battle Members Restriction                      │ v1.01 │ (03/11/15) ║
  3. # ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
  4. # ║ Author  : William Couillard                                               ║
  5. # ║ Thanks  : Traverse                                                        ║
  6. # ║ E-Mail  : cooliebk18@yahoo.com                                            ║
  7. # ║ Website : http://ffdiscovery.wikia.com                                    ║
  8. # ╠═══════════════════════════════════════════════════════════════════════════╣
  9. # ║ ABOUT                                                                     ║
  10. # ╠═══════════════════════════════════════════════════════════════════════════╣
  11. # ║ This script forces the default menus to only allow the player access to   ║
  12. # ║ party members who are in the current battle party. By default, all party  ║
  13. # ║ members are accessible, so even party members who aren't in battle can    ║
  14. # ║ use their skills or change their equipment. This script is intended to be ║
  15. # ║ used alongside a Party Change script, such as Yanfly's Party System.      ║
  16. # ╠═══════════════════════════════════════════════════════════════════════════╣
  17. # ║ TERMS OF USE                                                              ║
  18. # ╠═══════════════════════════════════════════════════════════════════════════╣
  19. # ║ ► Do not edit the script's header or comments.                            ║
  20. # ║ ► Free to use in commercial projects as long as proper credit is given to ║
  21. # ║   ALL the names in the above header.                                      ║
  22. # ╠═══════════════════════════════════════════════════════════════════════════╣
  23. # ║ FEATURES                                                                  ║
  24. # ╠═══════════════════════════════════════════════════════════════════════════╣
  25. # ║ ► Restricts default menus to only allow access to party members who are   ║
  26. # ║   in the active battle party. Custom menus for other scenes are not       ║
  27. # ║   affected.                                                               ║
  28. # ╠═══════════════════════════════════════════════════════════════════════════╣
  29. # ║ KNOWN ISSUES                                                              ║
  30. # ╠═══════════════════════════════════════════════════════════════════════════╣
  31. # ║ ► None.                                                                   ║
  32. # ╠═══════════════════════════════════════════════════════════════════════════╣
  33. # ║ CHANGE LOG                                                                ║
  34. # ╠═════════════════════════════════════════════════════════════════╤═════════╣
  35. # ║ ■ March 11, 2015    : Bugfixes.                                 │ (v1.01) ║
  36. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  37. # ║ ■ December 04, 2014 : Initial release.                          │ (v1.00) ║
  38. # ╠═════════════════════════════════════════════════════════════════╧═════════╣
  39. # ║ OVERWRITTEN METHODS                                                       ║
  40. # ╠═══════════════════════════════════════════════════════════════════════════╣
  41. # ║   This script overwrites a few methods in various default scripts.        ║
  42. # ╟───────────────────────────────────────────────────────────────────────────╢
  43. # ║ ■ class Game_Party < Game_Unit                                            ║
  44. # ║    ► def menu_actor_next                                                  ║
  45. # ║    ► def menu_actor_prev                                                  ║
  46. # ╟───────────────────────────────────────────────────────────────────────────╢
  47. # ║ ■ class Window_MenuStatus < Window_Selectable                             ║
  48. # ║    ► def item_max                                                         ║
  49. # ║    ► def draw_item                                                        ║
  50. # ║    ► def process_ok                                                       ║
  51. # ╠═══════════════════════════════════════════════════════════════════════════╣
  52. # ║ INSTRUCTIONS                                                              ║
  53. # ╠═══════════════════════════════════════════════════════════════════════════╣
  54. # ║ Simply paste this script anywhere BELOW Window_MenuStatus. If you are     ║
  55. # ║ using this script alongside Yanfly's Party System, place this script      ║
  56. # ║ below it.                                                                 ║
  57. # ╠═══════════════════════════════════════════════════════════════════════════╣
  58. # ║ IMPORT SETTING                                                            ║
  59. # ╚═══════════════════════════════════════════════════════════════════════════╝
  60. $imported = {} if $imported.nil?                    # Do not edit
  61. $imported["WC-BattleMemberRestriction_1.00"] = true # Do not edit
  62. # ╔═══════════════════════════════════════════════════════════════════════════╗
  63. # ║ ** Game_Party                                                             ║
  64. # ╟───────────────────────────────────────────────────────────────────────────╢
  65. # ║  This class handles parties. Information such as gold and items is        ║
  66. # ║ included. Instances of this class are referenced by $game_party.          ║
  67. # ╚═══════════════════════════════════════════════════════════════════════════╝
  68. class Game_Party < Game_Unit
  69. # ╔═══════════════════════════════════════════════════════════════════════════╗
  70. # ║ SELECT NEXT ACTOR ON MENU SCREEN                                          ║
  71. # ╚═══════════════════════════════════════════════════════════════════════════╝
  72.   def menu_actor_next
  73.     index = battle_members.index(menu_actor) || -1
  74.     index = (index + 1) % battle_members.size
  75.     self.menu_actor = battle_members[index]
  76.   end
  77. # ╔═══════════════════════════════════════════════════════════════════════════╗
  78. # ║ SELECT PREVIOUS ACTOR ON MENU SCREEN                                      ║
  79. # ╚═══════════════════════════════════════════════════════════════════════════╝
  80.   def menu_actor_prev
  81.     index = battle_members.index(menu_actor) || 1
  82.     index = (index + battle_members.size - 1) % battle_members.size
  83.     self.menu_actor = battle_members[index]
  84.   end
  85. end
  86. # ╔═══════════════════════════════════════════════════════════════════════════╗
  87. # ║ ** Window_MenuStatus                                                      ║
  88. # ╟───────────────────────────────────────────────────────────────────────────╢
  89. # ║  This window displays party member status on the menu screen.             ║
  90. # ╚═══════════════════════════════════════════════════════════════════════════╝
  91. class Window_MenuStatus < Window_Selectable
  92. # ╔═══════════════════════════════════════════════════════════════════════════╗
  93. # ║ GET NUMBER OF ITEMS                                                       ║
  94. # ╚═══════════════════════════════════════════════════════════════════════════╝
  95.   def item_max
  96.     $game_party.battle_members.size
  97.   end
  98. # ╔═══════════════════════════════════════════════════════════════════════════╗
  99. # ║ DRAW ITEM                                                                 ║
  100. # ╚═══════════════════════════════════════════════════════════════════════════╝
  101.   def draw_item(index)
  102.     actor = $game_party.battle_members[index]
  103.     enabled = $game_party.battle_members.include?(actor)
  104.     rect = item_rect(index)
  105.     draw_item_background(index)
  106.     draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)
  107.     draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)
  108.   end
  109. # ╔═══════════════════════════════════════════════════════════════════════════╗
  110. # ║ PROCESSING WHEN OK BUTTON IS PRESSED                                      ║
  111. # ╚═══════════════════════════════════════════════════════════════════════════╝
  112.   def process_ok
  113.     super
  114.     $game_party.menu_actor = $game_party.battle_members[index]
  115.   end
  116. end
  117. # ╔═══════════════════════════════════════════════════════════════════════════╗
  118. # ║ END OF SCRIPT                                                             ║
  119. # ╚═══════════════════════════════════════════════════════════════════════════╝
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement