Vehicle issue

Hello guys im new here and i dont have a lot experience about making a game and i need help about something is bothering me
for hours :/ How can i make the boat vehicle pass the deepwater tiles? I know it can only pass by shallow water tiles and im searching scripts for changing it for hours....so yeah any ideas to make the boat able to pass by deep water tiles? I have to edit a script part or something like that?


(EDIT) I finally found a way to fix this simply going to game map page in scripts, line 484
and i edited the (x, y, 0x0200) to (x, y, 0x0400) same as the ships's check passage...no idea how is this works but im glad i fixed that....
one more thing....is it possible to make it able to go through water vortex with a similiar way?
Hello there. First of all: what's the point of changing boat passability rules to be the same as ship ones? Isn't it faster to change ship graphic into a boat and then use that one instead of having two vehicles behaving the same?

Spoiler: Brief explaination about why changing that value on line 484 works
The line you changed passes that hexadecimal value to the check_passage method. The method then checks tileset flags and compares them to that value using the "&" operator. You can find more informations about ruby operators here.
If you understand how the operator works then you should be able to pass a value on your own. However you will soon enough find out that you will be able to pass over other tiles too. That because different tiles have the same tileset flag by default. Of course you can alter it since assigning a terrain tag to a tile in your tileset table (F9 > Tilesets tab) changes the flag value.

In my opinion you can use the terrain tag to set passability the way you want without having to compare it bit by bit. First of all set the terrain tag to the value you want it to be (it can be an integer between 0 and 7) then add the following script below Materials in your script editor (change it to fit your needs).
Spoiler
Code:
module HSVP
  #=============================================================================
  # Change the following values with the terrain tag you want to be passable for
  # each vehicle. Separate different tags with commas.
  #-----------------------------------------------------------------------------
  # Example:
  # BOAT_PASSABLE_TAGS = [2, 4, 7]
  # This means that tiles 2, 4 and 7 are passable by boat even if their normal
  # passability is set to X
  #=============================================================================
 
  BOAT_PASSABLE_TAGS = []
  SHIP_PASSABLE_TAGS = []
 
  #=============================================================================
  # Do not modify after this point unless you know what you are doing.
  #=============================================================================

  def self.boat_special?
    return (BOAT_PASSABLE_TAGS.size > 0)
  end

  def self.ship_special?
    return (SHIP_PASSABLE_TAGS.size > 0)
  end
 
  def self.check_xy_tag(x, y, vehicle)
    value = false
    case vehicle
    when 0
      value = BOAT_PASSABLE_TAGS.include?($game_map.terrain_tag(x, y))
    when 1
      value = SHIP_PASSABLE_TAGS.include?($game_map.terrain_tag(x, y))
    end
  end

end

class Game_Map
  def boat_passable?(x, y)
    hsvp_psg = check_passage(x, y, 0x0200)
    HSVP.boat_special? ? (hsvp_psg || HSVP.check_xy_tag(x, y, 0)) : (hsvp_psg)
  end

  def ship_passable?(x, y)
    hsvp_psg = check_passage(x, y, 0x0400)
    HSVP.ship_special? ? (hsvp_psg || HSVP.check_xy_tag(x, y, 1)) : (hsvp_psg)
  end

end
Hello there. First of all: what's the point of changing boat passability rules to be the same as ship ones? Isn't it faster to change ship graphic into a boat and then use that one instead of having two vehicles behaving the same?

I thought that but i want to have both ship and boat in my game so this is not possible because if i change the ship graphic to boat
then i have to change the boat graphic to ship....but then the ship will have the same properties as the boat....

About your script i will
try it right now and see if it work...this is an awesome idea and finally i found a script about this!

The line you changed passes that hexadecimal value to the check_passage method. The method then checks tileset flags and compares them to that value using the "&" operator. You can find more informations about ruby operators here.
If you understand how the operator works then you should be able to pass a value on your own. However you will soon enough find out that you will be able to pass over other tiles too. That because different tiles have the same tileset flag by default. Of course you can alter it since assigning a terrain tag to a tile in your tileset table (F9 > Tilesets tab) changes the flag value.


I cant understand it at all can you explain me what do you mean?
what difference you want the ship and the boat to have then? Because if they both have full deep water passability, then there is no need for an additional boat anymore.

I think you're running off in the wrong direction, it is better if you tell us what you want the player to be able to do before changing any script.
i just fixed what i wanted....the difference between boat and ship i wanted was to both can pass through deep and shallow water but the
ship to be able to go through vortex
If that's the case the scipt in my previous post should fix that.
Thx for your help man ☺

Original thread: https://forums.rpgmakerweb.com/threads/vehicle-issue.76293/