Galv Vehicle On/Off Locations Addon: Vehicle Terrain/Region Passability

Panda_Artist

Humble RPG Fan
Veteran
Joined
Dec 22, 2018
Messages
241
Reaction score
15
First Language
Portuguese
Primarily Uses
RMVXA
Good Morning / Day / Afternoon / Evening everyone.

I once again have a request

I would really appreciate an addon for Galv's script

The current script allows you to define terrains and regions for which the vehicles can land on. But is it possible to also include the ability to define terrain and regions which the vehicle can pass on? (vehicle passability), for example boat can pass through terrain tag 1 or region 15.

Any help would be appreciated.

Ruby:
#------------------------------------------------------------------------------#
#  Galv's Vehicle On Off Locations
#------------------------------------------------------------------------------#
#  For: RPGMAKER VX ACE
#  Version 1.5
#------------------------------------------------------------------------------#
#  2013-01-22 - Version 1.5 - added ability to use terrain tags as well
#  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 = []    # Ships can only land at these region and
                          # the player can only board from these region.
  BOAT_TERRAIN = [1,2,3,4,5]       # Can use terrain tags as well for this.


  SHIP_REGIONS = []      # Ships can only land at these region and
                          # the player can only board from these region.
  SHIP_TERRAIN = [1,2,3,4,5]       # Can use terrain tags as well for this.


  AIRSHIP_REGIONS = [1]   # Airships can only land on these regions
  AIRSHIP_TERRAIN = [1]    # Can use terrain tags as well for this.
   
  Chocobo_REGIONS = [1]   # Cars can only land on a car region
  Chocobo_TERRAIN = [1]    # Can use terrain tags as well for this.

  # NOTES:

  # When no region tile is painted, it is 0
  # Terrain tags can be set in your database tilesets and are 0 by default

  # 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]
  # SHIP_TERRAIN = [5,6,3]


  B_MSG = ""  # Message displayed when can't board.
                                      # Make this B_MSG = "" to not use this.

#------------------------------------------------------------------------------#
#  END SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#

end

class Game_Vehicle < Game_Character
  alias galv_vonoff_land_ok? land_ok?
  def land_ok?(x, y, d)
    return false unless $game_map.vland?(x,y,d,@type)
    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)
    terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
    board = false
    if $game_map.boat.pos?(front_x, front_y)
      board = true if Vehicle_On_Off::BOAT_REGIONS.include?(region) ||
      Vehicle_On_Off::BOAT_TERRAIN.include?(terrain)
    elsif $game_map.ship.pos?(front_x, front_y)
      board = true if Vehicle_On_Off::SHIP_REGIONS.include?(region) ||
      Vehicle_On_Off::SHIP_TERRAIN.include?(terrain)
    elsif $game_map.airship.pos?(@x, @y)
      board = true
    else
      board = nil
    end
    return vehicle_msg if board == false
    galv_vonoff_get_on_vehicle
  end

  def vehicle_msg
    $game_message.add(Vehicle_On_Off::B_MSG) if Vehicle_On_Off::B_MSG != ""
  end
end # Game_Player < Game_Character

class Game_Map
  def vland?(x,y,d,type)
    check_dir(x, y, d)
    case type
    when :boat
      regions = Vehicle_On_Off::BOAT_REGIONS
      terrain = Vehicle_On_Off::BOAT_TERRAIN
    when :ship
      regions = Vehicle_On_Off::SHIP_REGIONS
      terrain = Vehicle_On_Off::SHIP_TERRAIN
    when :airship
      regions = Vehicle_On_Off::AIRSHIP_REGIONS
      terrain = Vehicle_On_Off::AIRSHIP_TERRAIN
      @front_x = $game_player.x; @front_y = $game_player.y
     when :chocobo
      regions = Vehicle_On_Off::Chocobo_REGIONS
      terrain = Vehicle_On_Off::Chocobo_TERRAIN
      @front_x = $game_player.x; @front_y = $game_player.y  
    end
    regions.include?(region_id(@front_x, @front_y)) ||
    terrain.include?(terrain_tag(@front_x, @front_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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,190
Members
137,772
Latest member
Kirakirna
Top