Advertisement
WCouillard

RGSS3: Battle Turn Indicator v1.00 [RMVXA]

Oct 16th, 2020 (edited)
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 16.87 KB | None | 0 0
  1. # ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
  2. # ║ Battle Turn Indicator                                │ v1.00 │ 10/16/2020 ║
  3. # ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
  4. # ║ Author  : Coolie                                                          ║
  5. # ║ E-Mail  : cooliebk18@yahoo.com                                            ║
  6. # ║ Website : http://twitch.tv/CoolieBK18                                     ║
  7. # ╠═══════════════════════════════════════════════════════════════════════════╣
  8. # ║ ABOUT                                                                     ║
  9. # ╠═══════════════════════════════════════════════════════════════════════════╣
  10. # ║ This script adds a battle turn indicator in battles. It starts at turn 1  ║
  11. # ║ even though a battle is actually at turn 0 when a battle begins.          ║
  12. # ╠═══════════════════════════════════════════════════════════════════════════╣
  13. # ║ TERMS OF USE                                                              ║
  14. # ╠═══════════════════════════════════════════════════════════════════════════╣
  15. # ║ ► Do not edit the script's header or comments.                            ║
  16. # ║ ► Free to use in commercial projects as long as proper credit is given to ║
  17. # ║   ALL the names individually in the above header.                         ║
  18. # ╠═══════════════════════════════════════════════════════════════════════════╣
  19. # ║ FEATURES                                                                  ║
  20. # ╠═══════════════════════════════════════════════════════════════════════════╣
  21. # ║ ► Adds a battle turn indicator in battle.                                 ║
  22. # ╠═══════════════════════════════════════════════════════════════════════════╣
  23. # ║ KNOWN ISSUES                                                              ║
  24. # ╠═══════════════════════════════════════════════════════════════════════════╣
  25. # ║ ► None so far!                                                            ║
  26. # ╠═══════════════════════════════════════════════════════════════════════════╣
  27. # ║ CHANGE LOG                                                                ║
  28. # ╠═════════════════════════════════════════════════════════════════╤═════════╣
  29. # ║ ■ October 16, 2020  : Initial version                           │ (v1.00) ║
  30. # ╠═════════════════════════════════════════════════════════════════╧═════════╣
  31. # ║ NEXT VERSION                                                              ║
  32. # ╠═══════════════════════════════════════════════════════════════════════════╣
  33. # ║ ■ TBA                                                                     ║
  34. # ╠═══════════════════════════════════════════════════════════════════════════╣
  35. # ║ NEW METHODS                                                               ║
  36. # ╠═══════════════════════════════════════════════════════════════════════════╣
  37. # ║   There is one new class and several new methods added.                   ║
  38. # ╟───────────────────────────────────────────────────────────────────────────╢
  39. # ║ ■ class Window_TurnCount < Window_Base                                    ║
  40. # ║    ► def initialize                                                       ║
  41. # ║    ► def window_width                                                     ║
  42. # ║    ► def update                                                           ║
  43. # ║    ► def def refresh                                                      ║
  44. # ║ ■ class Scene_Battle < Scene_Base                                         ║
  45. # ║    ► def create_all_windows [Alias]                                       ║
  46. # ║    ► def create_turn_count_window                                         ║
  47. # ║    ► def battle_start [Alias]                                             ║
  48. # ║    ► def turn_start [Alias]                                               ║
  49. # ║    ► def turn_end [Alias]                                                 ║
  50. # ╠═══════════════════════════════════════════════════════════════════════════╣
  51. # ║ INSTRUCTIONS                                                              ║
  52. # ╠═══════════════════════════════════════════════════════════════════════════╣
  53. # ║ Simply paste this script anywhere above the Main Process script and below ║
  54. # ║ the "Materials" section.                                                  ║
  55. # ╠═══════════════════════════════════════════════════════════════════════════╣
  56. # ║ IMPORT SETTING                                                            ║
  57. # ╚═══════════════════════════════════════════════════════════════════════════╝
  58. $imported = {} if $imported.nil?                  # Do not edit
  59. $imported["WC-BattleTurnIndicator_1.00"] = true   # Do not edit
  60.  
  61. # ╔═══════════════════════════════════════════════════════════════════════════╗
  62. # ║ NEW CLASS: Window_TurnCount                                               ║
  63. # ╟───────────────────────────────────────────────────────────────────────────╢
  64. # ║ This window displays the turn count in battle                             ║
  65. # ╚═══════════════════════════════════════════════════════════════════════════╝
  66. class Window_TurnCount < Window_Base
  67.   # ╔═════════════════════════════════════════════════════════════════════════╗
  68.   # ║ Object Initialization                                                   ║
  69.   # ╚═════════════════════════════════════════════════════════════════════════╝
  70.   def initialize
  71.     super(0, 0, window_width, fitting_height(1))
  72.     self.opacity = 0
  73.     self.back_opacity = 0
  74.     self.contents_opacity = 255
  75.     refresh
  76.   end
  77.   # ╔═════════════════════════════════════════════════════════════════════════╗
  78.   # ║ Get Window Width                                                        ║
  79.   # ╚═════════════════════════════════════════════════════════════════════════╝
  80.   def window_width
  81.     return 80
  82.   end
  83.   # ╔═════════════════════════════════════════════════════════════════════════╗
  84.   # ║ Frame Update                                                            ║
  85.   # ╚═════════════════════════════════════════════════════════════════════════╝
  86.   def update
  87.     super
  88.   end
  89.   # ╔═════════════════════════════════════════════════════════════════════════╗
  90.   # ║ Refresh                                                                 ║
  91.   # ╚═════════════════════════════════════════════════════════════════════════╝
  92.   def refresh
  93.     contents.clear
  94.     $turn_counter = 1 + $game_troop.turn_count
  95.     change_color(system_color)
  96.     # Change "Turn" to whatever text you want to display in battle
  97.     draw_text(0, 0, 68, 24, "Turn ", 0)
  98.     change_color(normal_color)
  99.     draw_text(36, 0, 68, 24, $turn_counter.to_s, 0)
  100.   end
  101.   # ╔═════════════════════════════════════════════════════════════════════════╗
  102.   # ║ End: Window_TurnCount                                                   ║
  103.   # ╚═════════════════════════════════════════════════════════════════════════╝
  104. end
  105. # ╔═══════════════════════════════════════════════════════════════════════════╗
  106. # ║ Scene_Battle                                                              ║
  107. # ╟───────────────────────────────────────────────────────────────────────────╢
  108. # ║ This class performs battle screen processing.                             ║
  109. # ╚═══════════════════════════════════════════════════════════════════════════╝
  110. class Scene_Battle < Scene_Base
  111.   # ╔═════════════════════════════════════════════════════════════════════════╗
  112.   # ║ Alias: Create All Windows                                               ║
  113.   # ╚═════════════════════════════════════════════════════════════════════════╝
  114.   alias coolie_create_all_windows create_all_windows
  115.   def create_all_windows
  116.     coolie_create_all_windows
  117.     create_turn_count_window
  118.   end
  119.   # ╔═════════════════════════════════════════════════════════════════════════╗
  120.   # ║ New: Create Turn Count Window                                           ║
  121.   # ╚═════════════════════════════════════════════════════════════════════════╝
  122.   def create_turn_count_window
  123.     @turn_count_window = Window_TurnCount.new
  124.     @turn_count_window.x = Graphics.width - 96
  125.     @turn_count_window.width = 80
  126.     @turn_count_window.y = 60
  127.   end
  128.   # ╔═════════════════════════════════════════════════════════════════════════╗
  129.   # ║ Alias: Battle Start                                                     ║
  130.   # ╚═════════════════════════════════════════════════════════════════════════╝
  131.   alias coolie_battle_start battle_start
  132.   def battle_start
  133.     coolie_battle_start
  134.     @turn_count_window.show
  135.   end
  136.   # ╔═════════════════════════════════════════════════════════════════════════╗
  137.   # ║ Alias: Start Turn                                                       ║
  138.   # ╚═════════════════════════════════════════════════════════════════════════╝
  139.   alias coolie_turn_start turn_start
  140.   def turn_start
  141.     coolie_turn_start
  142.     @turn_count_window.refresh
  143.   end
  144.   # ╔═════════════════════════════════════════════════════════════════════════╗
  145.   # ║ Alias: End Turn                                                         ║
  146.   # ╚═════════════════════════════════════════════════════════════════════════╝
  147.   alias coolie_turn_end turn_end
  148.   def turn_end
  149.     coolie_turn_end
  150.     @turn_count_window.refresh
  151.   end
  152.   # ╔═════════════════════════════════════════════════════════════════════════╗
  153.   # ║ End: Scene_Battle                                                       ║
  154.   # ╚═════════════════════════════════════════════════════════════════════════╝
  155. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement