WCouillard

RGSS3: Land Vehicle v1.05 [RMVXA]

Dec 5th, 2012
3,944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # ╔════════════════════════════════════════════════════╤═══════╤══════════════╗
  2. # ║ Land Vehicle                                       │ v1.05 │ (09/01/2015) ║
  3. # ╠════════════════════════════════════════════════════╧═══════╧══════════════╣
  4. # ║ Author:  William Couillard                                                ║
  5. # ║ Thanks:  Galv (http://galveraxe.wordpress.com/)                           ║
  6. # ║          Mr. Trivel                                                       ║
  7. # ║ E-Mail:  cooliebk18@yahoo.com                                             ║
  8. # ╠═══════════════════════════════════════════════════════════════════════════╣
  9. # ║ ABOUT                                                                     ║
  10. # ╠═══════════════════════════════════════════════════════════════════════════╣
  11. # ║ This script changes how the "Boat" vehicle functions. By default, the     ║
  12. # ║ boat an travel on water, the same as the ship. Why isn't there a land     ║
  13. # ║ vehicle? This script changes the boat to function as a land vehicle, able ║
  14. # ║ to travel over any terrain that the player can (at a faster speed and     ║
  15. # ║ without encounters), and blocks it from traveling over water or           ║
  16. # ║ activating touch and confirm event processes.                             ║
  17. # ║                                                                           ║
  18. # ║ Anyone familiar with how Chocobos functioned in the SNES-era Final        ║
  19. # ║ Fantasy titles should notice similarities here.                           ║
  20. # ╠═══════════════════════════════════════════════════════════════════════════╣
  21. # ║ TERMS OF USE                                                              ║
  22. # ╠═══════════════════════════════════════════════════════════════════════════╣
  23. # ║ ► Do not edit the script's header or comments.                            ║
  24. # ║ ► Free to use in commercial projects as long as proper credit is given to ║
  25. # ║   ALL the names in the above header.                                      ║
  26. # ╠═══════════════════════════════════════════════════════════════════════════╣
  27. # ║ CHANGE LOG                                                                ║
  28. # ╠═════════════════════════════════════════════════════════════════╤═════════╣
  29. # ║ ■ September 01, 2015 : Added aliases to improve compatibility.  │ (v1.05) ║
  30. # ║                        Patch for Galv On/Off integrated         │         ║
  31. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  32. # ║ ■ October 31, 2014   : Option to disable stepping animation.    │ (v1.04) ║
  33. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  34. # ║ ■ July 21, 2014      : Option to disable action button events.  │ (v1.03) ║
  35. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  36. # ║ ■ January  30, 2013  : Bug fixed.                               │ (v1.02) ║
  37. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  38. # ║ ■ December 01, 2012  : Added option to keep encounters & touch  │ (v1.01) ║
  39. # ║                        events.                                  │         ║
  40. # ╟─────────────────────────────────────────────────────────────────┼─────────╢
  41. # ║ ■ November 27, 2012 : Initial release.                          │ (v1.00) ║
  42. # ╠═════════════════════════════════════════════════════════════════╧═════════╣
  43. # ║ NEXT VERSION                                                              ║
  44. # ╠═══════════════════════════════════════════════════════════════════════════╣
  45. # ║ ■ Script completed!                                                       ║
  46. # ╠═══════════════════════════════════════════════════════════════════════════╣
  47. # ║ OVERWRITTEN METHODS                                                       ║
  48. # ╠═══════════════════════════════════════════════════════════════════════════╣
  49. # ║   This script overwrites or aliases a few methods in various default      ║
  50. # ║   scripts.                                                                ║
  51. # ╟───────────────────────────────────────────────────────────────────────────╢
  52. # ║ ■ class Game_Map                                                          ║
  53. # ║    ► def boat_passable?                                                   ║
  54. # ╟───────────────────────────────────────────────────────────────────────────╢
  55. # ║ ■ class Game_Player < Game_Character                                      ║
  56. # ║    ► def map_passable?                                                    ║
  57. # ║    ► def update_encounter                                                 ║
  58. # ║    ► def check_touch_event                                                ║
  59. # ║    ► def check_action_event                                               ║
  60. # ╟───────────────────────────────────────────────────────────────────────────╢
  61. # ║ ■ class Game_Vehicle > Game_Character                                     ║
  62. # ║    ► def init_move_speed                                                  ║
  63. # ║    ► def get_on                                                           ║
  64. # ╠═══════════════════════════════════════════════════════════════════════════╣
  65. # ║ INSTRUCTIONS                                                              ║
  66. # ╠═══════════════════════════════════════════════════════════════════════════╣
  67. # ║   Paste this script ABOVE Main and BELOW Game_Vehicle.                    ║
  68. # ╠═══════════════════════════════════════════════════════════════════════════╣
  69. # ║ IMPORT SETTING                                                            ║
  70. # ╚═══════════════════════════════════════════════════════════════════════════╝
  71. $imported = {} if $imported.nil?
  72. $imported[:wc_land_vehicle] = true
  73. # ╔═══════════════════════════════════════════════════════════════════════════╗
  74. # ║ CUSTOMIZATION MODULE                                                      ║
  75. # ╚═══════════════════════════════════════════════════════════════════════════╝
  76. module COOLIE
  77.   module VEHICLE
  78. # ╔═══════════════════════════════════════════════════════════════════════════╗
  79. # ║ VEHICLE SPEED: Set from 1-6 [Higher no. = higher speed]                   ║
  80. # ╚═══════════════════════════════════════════════════════════════════════════╝
  81.     VEHICLE_SPEED      = 5
  82. # ╔═══════════════════════════════════════════════════════════════════════════╗
  83. # ║ VEHICLE ENCOUNTERS: Set to true to allow enemy encounters while piloting. ║
  84. # ╚═══════════════════════════════════════════════════════════════════════════╝
  85.     VEHICLE_ENCOUNTERS = false
  86. # ╔═══════════════════════════════════════════════════════════════════════════╗
  87. # ║ VEHICLE TOUCH: Set to true to allow touch event processing.               ║
  88. # ╚═══════════════════════════════════════════════════════════════════════════╝
  89.     VEHICLE_TOUCH      = false
  90. # ╔═══════════════════════════════════════════════════════════════════════════╗
  91. # ║ VEHICLE PRESS: Set to true to allow action button event processing.       ║
  92. # ╚═══════════════════════════════════════════════════════════════════════════╝
  93.     VEHICLE_PRESS      = false
  94. # ╔═══════════════════════════════════════════════════════════════════════════╗
  95. # ║ STEP ANIM: When false, vehicle will not use step animation when idle.     ║
  96. # ╚═══════════════════════════════════════════════════════════════════════════╝
  97.     STEP_ANIM          = false
  98.   end
  99. end
  100. #-------------------------------------------------------------------------------
  101. class Game_Map
  102. # ╔═══════════════════════════════════════════════════════════════════════════╗
  103. # ║ Determine if Passable by Land Vehicle                  [OVERWRITE METHOD] ║
  104. # ╟───────────────────────────────────────────────────────────────────────────╢
  105. # ║ Changes the Boat vehicle to have the same passability as the player.      ║
  106. # ║ I.E. Can travel on land, not water. Cannot pass through same level tiles. ║
  107. # ╚═══════════════════════════════════════════════════════════════════════════╝
  108.   def boat_passable?(x, y, d)
  109.     check_passage(x, y, (1 << (d / 2 - 1)) & 0x0f)
  110.   end
  111. end
  112.  
  113. class Game_Player < Game_Character
  114. # ╔═══════════════════════════════════════════════════════════════════════════╗
  115. # ║ Map Passable?                                          [OVERWRITE METHOD] ║
  116. # ╟───────────────────────────────────────────────────────────────────────────╢
  117. # ║ Determines passability.                                                   ║
  118. # ╚═══════════════════════════════════════════════════════════════════════════╝
  119.   def map_passable?(x, y, d)
  120.     case @vehicle_type
  121.     when :boat
  122.       $game_map.boat_passable?(x, y, d)
  123.     when :ship
  124.       if $imported["Galv_Vehicle_On_Off"]
  125.         $game_map.ship_passable?(x, y, d)
  126.       else
  127.         $game_map.ship_passable?(x, y)
  128.       end
  129.     when :airship
  130.       true
  131.     else
  132.       super
  133.     end
  134.   end
  135. # ╔═══════════════════════════════════════════════════════════════════════════╗
  136. # ║ Update Encounters                                      [OVERWRITE METHOD] ║
  137. # ╟───────────────────────────────────────────────────────────────────────────╢
  138. # ║ Turns off encounters if piloting the Land Vehicle.                        ║
  139. # ╚═══════════════════════════════════════════════════════════════════════════╝
  140.   def update_encounter
  141.     return if $TEST && Input.press?(:CTRL)
  142.     return if $game_party.encounter_none?
  143.     return if in_airship?
  144.     unless COOLIE::VEHICLE::VEHICLE_ENCOUNTERS
  145.       return if in_boat?
  146.     end
  147.     return if @move_route_forcing
  148.     @encounter_count -= encounter_progress_value
  149.   end
  150. # ╔═══════════════════════════════════════════════════════════════════════════╗
  151. # ║ Determine if Event Start Caused by Touch (Overlap)         [ALIAS METHOD] ║
  152. # ╟───────────────────────────────────────────────────────────────────────────╢
  153. # ║ Disables touch events when driving the Land Vehicle, including teleports. ║
  154. # ╚═══════════════════════════════════════════════════════════════════════════╝
  155.   alias :wc_land_vehicle_check_touch_event :check_touch_event
  156.     def check_touch_event
  157.     unless COOLIE::VEHICLE::VEHICLE_TOUCH
  158.       return false if in_boat?
  159.     end
  160.     wc_land_vehicle_check_touch_event
  161.   end
  162.  
  163. # ╔═══════════════════════════════════════════════════════════════════════════╗
  164. # ║ Determine if Event Start Caused by OK Button (Action)      [ALIAS METHOD] ║
  165. # ╟───────────────────────────────────────────────────────────────────────────╢
  166. # ║ Disables "action button" events when driving the Land Vehicle.            ║
  167. # ╚═══════════════════════════════════════════════════════════════════════════╝
  168.   alias :wc_land_vehicle_check_action_event :check_action_event
  169.     def check_action_event
  170.     unless COOLIE::VEHICLE::VEHICLE_PRESS
  171.       return false if in_boat?
  172.     end
  173.     wc_land_vehicle_check_action_event
  174.   end
  175. end # class Game_Player
  176.  
  177. class Game_Vehicle < Game_Character
  178. # ╔═══════════════════════════════════════════════════════════════════════════╗
  179. # ║ Initialize Move Speed                                      [ALIAS METHOD] ║
  180. # ╟───────────────────────────────────────────────────────────────────────────╢
  181. # ║ Changes the player's movement speed when piloting the Land Vehicle.       ║
  182. # ╚═══════════════════════════════════════════════════════════════════════════╝
  183.   alias :wc_land_vehicle_init_move_speed :init_move_speed
  184.   def init_move_speed
  185.     wc_land_vehicle_init_move_speed
  186.     @move_speed = COOLIE::VEHICLE::VEHICLE_SPEED if @type == :boat
  187.   end
  188.  
  189. # ╔═══════════════════════════════════════════════════════════════════════════╗
  190. # ║ Get On                                                     [ALIAS METHOD] ║
  191. # ╟───────────────────────────────────────────────────────────────────────────╢
  192. # ║ Handles the functions of the vehicle when entering it.                    ║
  193. # ╚═══════════════════════════════════════════════════════════════════════════╝
  194.   alias :wc_land_vehicle_get_on :get_on
  195.     def get_on
  196.     wc_land_vehicle_get_on
  197.     @step_anime = COOLIE::VEHICLE::STEP_ANIM
  198.     end
  199. end # class Game_Vehicle
RAW Paste Data