Change vehicle image when it is being driven

I know it's possible to do this with events, but it would be much more convenient with a script, without having to put a event in every map. And parallel processes also can reduce performance...
I'm not sure how to help, but I think I may be able to.
Create a copy of your game before doing this, as any action could just blow it all up.

Ensure that the image index matches the correct vehicle state (driving, boarding, disembarking).

JavaScript:
#==============================================================================
# ** Game_Vehicle
#------------------------------------------------------------------------------
#  This class handles vehicles. It's used within the Game_Map class.
#==============================================================================
class Game_Vehicle
  #--------------------------------------------------------------------------
  # * Change Vehicle Image
  #--------------------------------------------------------------------------
  def change_image(filename, hue = 0)
    @character_name = filename
    @character_hue = hue
  end
end


#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
#  This class handles the player. This class wraps the interpreter class
# ($game_system), manages the party, cursor position, and map scrolling.
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * Alias Method: Get On Vehicle
  #--------------------------------------------------------------------------
  alias change_vehicle_image_get_on_vehicle get_on_vehicle
  def get_on_vehicle
    change_vehicle_image_get_on_vehicle
    change_vehicle_image if vehicle
  end
  #--------------------------------------------------------------------------
  # * Change Vehicle Image
  #--------------------------------------------------------------------------
  def change_vehicle_image
    case $game_player.vehicle_type
    when :boat
      $game_player.vehicle.change_image("Boat", 0)
    when :ship
      $game_player.vehicle.change_image("Ship", 0)
    when :airship
      $game_player.vehicle.change_image("Airship", 0)
    end
  end
end

Here's how this script works:

  1. Game_Vehicle:
    • This class handles vehicles.
    • The change_image method is added to Game_Vehicle, allowing you to change the vehicle's image.
  2. Game_Player:
    • This class handles the player.
    • You alias the get_on_vehicle method to run your custom code when the player gets on a vehicle.
    • In the change_vehicle_image method, you check the type of vehicle the player is currently on and change its image accordingly using the change_image method you defined in Game_Vehicle.

Original thread: https://forums.rpgmakerweb.com/threads/change-vehicle-image-when-it-is-being-driven.168440/