#------------------------------------------------------------------------------# # Galv's Vehicle On Off Locations #------------------------------------------------------------------------------# # For: RPGMAKER VX ACE # Version 1.4 #------------------------------------------------------------------------------# # 2013-01-17 - Version 1.4 - added 'cannot board' message and optimised code # 2012-10-24 - Version 1.3 - updated alias names for compatability # 2012-10-18 - Version 1.2 - Added ability to specify different regions for # - boat and possible to use multiple regions for each # 2012-09-26 - Version 1.1 - Changed name from 'Galv's Port Docking' # - Added landing zone region for airship # 2012-09-26 - Version 1.0 - release #------------------------------------------------------------------------------# # Specify regions that you can disembark/embark for boats, ships and airships. # Player can only get on or off those vehicles from the specified regions. # # Instructions: # Specify the region numbers you want to use for each vehicle in the settings. # Paint the tiles you want each vehicle to be able to land/embark at with the # specified region numbers. # #------------------------------------------------------------------------------# ($imported ||= {})["Galv_Vehicle_On_Off"] = true module Vehicle_On_Off #------------------------------------------------------------------------------# # SCRIPT SETUP OPTIONS #------------------------------------------------------------------------------# BOAT_REGIONS = [0, 1] # Ships can only land at these region and # the player can only board from these region. SHIP_REGIONS = [1, 3] # Ships can only land at these region and # the player can only board from these region. AIRSHIP_REGIONS = [2] # Airships can only land on an airship region # 0 is any tile not painted with a region number. # You can add as many regions as needed for these. For example: # SHIP_REGIONS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] BOARD_MSG = true # Show message if try to board when restricted (true/false) B_MSG = "I can't board from here." # Message displayed #------------------------------------------------------------------------------# # END SCRIPT SETUP OPTIONS #------------------------------------------------------------------------------# end class Game_Vehicle < Game_Character alias galv_vonoff_land_ok? land_ok? def land_ok?(x, y, d) case @type when :boat; return false unless $game_map.boatland?(x, y, d) when :ship; return false unless $game_map.shipland?(x, y, d) when :airship; return false unless $game_map.airland?(x, y) end galv_vonoff_land_ok?(x, y, d) end end # Game_Vehicle < Game_Character class Game_Player < Game_Character alias galv_vonoff_get_on_vehicle get_on_vehicle def get_on_vehicle front_x = $game_map.round_x_with_direction(@x, @direction) front_y = $game_map.round_y_with_direction(@y, @direction) @region = $game_map.region_id($game_player.x, $game_player.y) return vehicle_msg if !Vehicle_On_Off::BOAT_REGIONS.include?(@region) && $game_map.boat.pos?(front_x, front_y) return vehicle_msg if !Vehicle_On_Off::SHIP_REGIONS.include?(@region) && $game_map.ship.pos?(front_x, front_y) galv_vonoff_get_on_vehicle end def vehicle_msg $game_message.add(Vehicle_On_Off::B_MSG) if Vehicle_On_Off::BOARD_MSG end end # Game_Player < Game_Character class Game_Map def shipland?(x, y, d) check_dir(x, y, d) @region = region_id(@front_x, @front_y) Vehicle_On_Off::SHIP_REGIONS.include?(@region) end def boatland?(x, y, d) check_dir(x, y, d) @region = region_id(@front_x, @front_y) Vehicle_On_Off::BOAT_REGIONS.include?(@region) end def airland?(x, y) Vehicle_On_Off::AIRSHIP_REGIONS.include?(region_id(x, y)) end def check_dir(x, y, d) @front_x = round_x_with_direction(x, d) @front_y = round_y_with_direction(y, d) end end # Game_Map