Shenwolf Multi Vehicles Addon: Encounter and Terrain passibility options

Good Morning / Day / Afternoon / Evening everyone.

I have a request for a certain kind of script modification.

I am using Shenwolf Multi Vehicles to create extra vehicles ALONSIDE an addon by Roninator to give each vehicle a specific ID.

Ruby:
class Game_Map

  def create_vehicles
    # clear default data
    $data_system.boat = []
    @vehicles = []
#--------------------------------------------------------------
#  Create new vehicles by add_vehicle() calls here
#   parameters > type, speed, name, index, map, x, y, bgm
#     type  > :boat for land, :ship for sea, :airship for air
#     id    > id for vehicle
#     speed > numbers 1-6, 4 is normal speed
#     name  > character_name for the graphic
#     index > numbers 0-7 character_index for the graphic
#     map   > map id number the vehicle starts on
#     x     > x position the vehicle starts on
#     y     > y position the vehicle starts on
#     bgm   > music name to play while driving
#--------------------------------------------------------------
# To summon a vehicle, use this script call
#
#--------------------------------------------------------------
add_vehicle( :boat, 0, 4, "Vehicle", 6, 1, 5, 5, "Boat")
add_vehicle( :ship, 1, 5, "Vehicle", 4, 35, 255, 20, "Ship")
add_vehicle( :airship, 2, 5.5, "Vehicle", 0, 3, 13, 9, "Airship")
#--------------------------------------------------------------
  end

  # for boat to move on land
  def boat_passable?(x, y)
    check_passage(x, y, 0x0f)
  end
  # vehicle creation function
def add_vehicle(type, id, speed, name, index, map, x, y, bgm) # <- added id
@id = id #$data_system.boat.length
    $data_system.boat.push(RPG::System::Vehicle.new)
    $data_system.boat[@id].character_name = name
    $data_system.boat[@id].character_index = index
    $data_system.boat[@id].bgm = RPG::BGM.new(bgm)
    $data_system.boat[@id].start_map_id = map
    $data_system.boat[@id].start_x = x
    $data_system.boat[@id].start_y = y
    @vehicles[@id] = Multi_Vehicle.new(@id, speed, type)
  end
end

class Multi_Vehicle < Game_Vehicle
  # used to identify vehicles
  attr_accessor :vehicle_id
  attr_accessor :type
  def initialize(id, speed, type)
    @vehicle_id = id
    super(type)
    @move_speed = speed
  end
  # new way to access vehicles
  def system_vehicle
    return $data_system.boat[@vehicle_id]
  end
end

class Game_CharacterBase
  # new vehicle collision check
  def collide_with_vehicles?(x, y)
    @i=0
    while @i < $game_map.vehicles.length
      @v = $game_map.vehicles[@i]
      if (@v.type == :boat || @v.type == :ship) && @v.pos_nt?(x, y)
        return true
      end
      @i +=1
    end
    return false
  end
end

class Game_Player < Game_Character
  # keep got on vehicle id
  attr_accessor :vehicle_id
  # new way to access vehicles
  def vehicle
    return nil if @vehicle_type == :walk
    $game_map.vehicles[@vehicle_id]
  end
  # new way to get on vehicles
  def get_on_vehicle
    front_x = $game_map.round_x_with_direction(@x, @direction)
    front_y = $game_map.round_y_with_direction(@y, @direction)
    @i = 0
    while @i < $game_map.vehicles.length
      @v = $game_map.vehicles[@i]
      if (@v.type == :boat && @v.pos?(front_x, front_y)) ||
         (@v.type == :ship && @v.pos?(front_x, front_y)) ||
         (@v.type == :airship && @v.pos?(@x, @y))
        @vehicle_id = @i
        @vehicle_type = $game_map.vehicles[@i].type
      end
      @i +=1
    end
    if vehicle
      @vehicle_getting_on = true
      force_move_forward unless in_airship?
      @followers.gather
    end
    @vehicle_getting_on
  end
end

class Spriteset_Map
  # this is for airship shadow
  def update_shadow
    airship = $game_player.vehicle
    return nil if airship == nil
    return nil if airship.type != :airship
    @shadow_sprite.x = airship.screen_x
    @shadow_sprite.y = airship.screen_y + airship.altitude
    @shadow_sprite.opacity = airship.altitude * 8
    @shadow_sprite.update
  end
end

For this script to be complete it only needs two more things:

1. Encounter options for each vehicle
2. Terrain and Region options for each vehicle

Can this be done?
What do you have setup for your terrain features?
Testing these in my games works, although my terrain features is not doing what I want.
04.11.2020_14.52.39_REC.png


all of these are working just fine...
I have a better idea!


Let's try this vehicle script instead of Tsuki's.

When I use both terrain features and this one I get THIS ERROR

04.11.2020_14.29.04_REC.png



04.11.2020_14.29.15_REC.png


any way to fix this??
If you are going to try every different vehicle script then also test Shenwolf Multi Vehicles script. I got it from the steam workshop for vx ace.
I did and so far, the only one that seems to be workig for me is Victor's, I think that if we sort out this little incompatibility with Terrain features, I may be able to finally get it to work!

Plus that particular script doesn't give me options to move the vehicles via script calls, which I really need.
doesn't give me options to move the vehicles via script calls
Thanks for the suggestion. I modified Shenwolf's script to do that.
Pretty simple adjustment, once I realized that I had to start numbering at 0.

in the add vehicle section of the script I added in the id number for the vehicle created.
add_vehicle( :boat, ID#, 4, "Vehicle", 6, 1, 5, 5, "Boat")
add_vehicle( :boat, 0, 4, "Vehicle", 6, 1, 5, 5, "Boat")
add_vehicle( :boat, 1, 5, "Vehicle", 4, 35, 255, 20, "Ship")
add_vehicle( :boat, 2, 6, "Vehicle", 5, 1, 6, 8, "Ship")
The id must start at 0 and count up

then under def add_vehicle change it to
def add_vehicle(type, id, speed, name, index, map, x, y, bgm) # <- added id
@id = id #$data_system.boat.length

Then you can use the same command as Tsukihime's script
$game_map.vehicles[vehicle_id].set_location(map_id, x, y)
04.11.2020_19.33.36_REC.png

04.11.2020_19.33.50_REC.png



I must be doign something wrong
Nevermind the previous post! I managed to fix the issue, while we are at it... I was wondering: how difficult it would be to add a feature to change how encounters work and to change which terrain each vehicle can pass through or be blocked from, let's say I want to differentiate between a car and a horse, a car would have encounters but the horse doesn't the horse could travel shallow waters but not the car. Can this be done?
I managed to fix the issue
Good, cause all I see is that you didn't put a # in the line
Change encounters -> another script
terrain passage -> maybe another script
Yanfly restrict region is where I've been able to add conditions for restricting regions, but it would have to be changed to specify whatever vehicle you have in use.

Original thread: https://forums.rpgmakerweb.com/threads/shenwolf-multi-vehicles-addon-encounter-and-terrain-passibility-options.129532/