Introduction
This is a vehicle system that is similar to the Final Fantasy system. In this system, you get vehicles (a canoe, ship, and dragon), the world tileset for Aveyond 2 (free to use in freeware games), and some autotiles.
Demo
You can download the demo here: DOWNLOAD VEHICLE SYSTEM DEMO HERE
Screenshot
Script
You really should download the demo, becuase this system uses a mixture of script, map events, common events, variables, and switches. However, if you think you can figure it out on your own, here is the vehicle system script:
Add An Additional Vehicle
1. Create a switch for your new vehicle. Call it "using vehicle" (replace vehicle with the name of your vehicle).
2. Create two variables for your vehicle. Call them "vehicle x" and "vehicle y" (replace vehicle with the name of your vehicle).
3. Add an event on your map for your new vehicle. Set it up to look like the other vehicle events. Modify the switches on the event so that they are for your vehicle, not the dragon, canoe, or boat vehicle. Modify the script call in the event so that it is for your vehicle. For example:
4. Put your vehicle sprite in your project's "characters" folder. Make sure that the name of the vehicle is exactly what you specified in step 3. For example, hovercraft.png
5. Get a peice of paper and write down the slot numbers for your switch, your variables, and the event you created for your vehicle. You will need to reference them later in your code.
6. Open the script editor and go to the Vehicle Script section.
7. In def check_terrain, add a new if statement for your vehicle. For example:
8. In def enter_vehicle, add the switch you created for your vehicle to the list. For example:
9. In def enter_vehicle, add a new if statement for your vehicle. For example:
10. In def exit_vehicle, add a new if statement for your vehicle. For example:
Credits
SephirothSpawn: I made this script after studying SephirothSpawn's (mr. talented!) vehicle script.
DerVVulfman: Enhancing the system!
Bugs
If you find a bug, let me know! I'm crazy busy right now, but I will try to fix any problems. Or, if an advanced scripter wants to take over this project, feel free to do so (again, i'm crazy busy with work). There are some gotchas with this system:
1. Don't use terrain flags on any map but your world map. (if you do, put an if statement in the code so that the vehicle system only works with your world map.
2. If you use a tileset background for an event on your world map, your vehicle will go over it. Use an empty character sprite if you run into problems.
This is a vehicle system that is similar to the Final Fantasy system. In this system, you get vehicles (a canoe, ship, and dragon), the world tileset for Aveyond 2 (free to use in freeware games), and some autotiles.
Demo
You can download the demo here: DOWNLOAD VEHICLE SYSTEM DEMO HERE
Screenshot

Script
You really should download the demo, becuase this system uses a mixture of script, map events, common events, variables, and switches. However, if you think you can figure it out on your own, here is the vehicle system script:
Code:
Â
class Game_Character
 def passable?(x, y, d)
 Â
  # Get new coordinates
  new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
 Â
  # If coordinates are outside of map
  unless $game_map.valid?(new_x, new_y)
   return false
  end
 Â
  # If through is ON
  if @through
   return true
  end
   Â
  # If unable to leave first move tile in designated direction
  unless $game_map.passable?(x, y, d, self)
   return false
  end
 Â
  # If unable to enter move tile in designated direction
  unless $game_map.passable?(new_x, new_y, 10 - d)
   return false
  end
   Â
  #check terrain for vehicle
  check_terrain(new_x, new_y)  Â
  Â
  # Loop all events
  for event in $game_map.events.values
   # If event coordinates are consistent with move destination
   if event.x == new_x and event.y == new_y
    @state = true
    # If through is OFF
    unless event.through
     # If self is event
     if self != $game_player
      return false
     end
     # With self as the player and partner graphic as character
     if event.character_name != ""
      return false
     end
    end
   end
  end
 Â
  if @state == false
   return false
  end   Â
 Â
  # If player coordinates are consistent with move destination
  if $game_player.x == new_x and $game_player.y == new_y
   # If through is OFF
   unless $game_player.through
    # If your own graphic is the character
    if @character_name != ""
     return false
    end
   end
  end
  Â
 Â
  return true
 Â
 end
Â
 #--------------------------------------------------------------------------
 # * Check the terrain for the vehicle
 #  @terrain (0=none, 1=river, 2=ocean, 3=air, 4=ground)
 #  @vehicle (0=foot, 1=canoe, 2=boat, 3=dragon)
 #  @state (true=passable tile, false=unpassable tile)
 #--------------------------------------------------------------------------
 def check_terrain(new_x, new_y) Â
  @state = false
  @terrain = $game_map.terrain_tag(new_x, new_y)
  @vehicle = $game_variables[1]
 Â
  @state = true if @vehicle == 0 && @terrain == 4  #foot & ground
  @state = true if @vehicle == 1 && @terrain == 3  #canoe & river
  @state = true if @vehicle == 2 && @terrain == 2  #boat & ocean
  @state = true if @vehicle == 3          #dragon
  @state = true if @terrain == 0
 end
Â
end
Â
class Game_Player < Game_Character
Â
 alias in_vehicle_alias update
 #--------------------------------------------------------------------------
 # * Memorize actor graphic
 #--------------------------------------------------------------------------   Â
 def actor_memorize
  @actor_name = $game_actors[1].character_name
  @actor_hue = $game_actors[1].character_hue
  @battler_name = $game_actors[1].battler_name
  @battler_hue = $game_actors[1].battler_hue
  return true
 end
Â
 #--------------------------------------------------------------------------
 # * Restore actor graphic
 #--------------------------------------------------------------------------   Â
 def actor_restore
  actor = $game_actors[1]
  actor.set_graphic(@actor_name.to_s, @actor_hue, @battler_name.to_s, @battler_hue)
  $game_player.refresh
  return true
 end  Â
Â
 #--------------------------------------------------------------------------
 # * Enter a vehicle
 #--------------------------------------------------------------------------    Â
 def enter_vehicle(type)
 Â
  $game_system.menu_disabled = true
  $game_system.save_disabled = true  Â
 Â
  if type != "dragon"
   @through = true
   move_forward
   @through = false  Â
  end
 Â
  actor_memorize
  actor = $game_actors[1]  Â
  actor.set_graphic(type, @actor_hue, @battler_name.to_s, @battler_hue)
 Â
  $game_switches[1] = false   #Canoe Off  Â
  $game_switches[2] = false   #Boat Off  Â
  $game_switches[3] = false   #Dragon Off    Â
 Â
  if type == "canoe"
   $game_variables[1] = 1    #set terrian
   $game_switches[1] = true   #Canoe On
   Audio.bgm_play("Audio/BGM/047-Positive05", 100, 100) #play canoe music
Â
  elsif type == "boat"
   $game_variables[1] = 2    #set terrian
   $game_switches[2] = true   #Boat On   Â
   Audio.bgm_play("Audio/BGM/046-Positive04", 100, 100) #play ship music
  Â
  elsif type == "dragon"
   $game_variables[1] = 3    #set terrian
   $game_switches[3] = true   #Dragon On Â
   Audio.bgm_play("Audio/BGM/045-Positive03", 100, 100) #play dragon music
  Â
  end
 Â
  $game_player.refresh
  $game_map.refresh
 Â
  return true
 end
Â
 #--------------------------------------------------------------------------
 # * Enter a vehicle
 #--------------------------------------------------------------------------    Â
 def exit_vehicle
Â
  $game_system.menu_disabled = false  Â
  $game_system.save_disabled = false
 Â
  if @terrain == 4
     Â
   if $game_switches[1] == true    #getting off canoe
    canoe = $game_map.events[1]   #get canoe event
    canoe.moveto(x, y)        #move to player's x, y coords
    $game_switches[1] = false    #Canoe Off Â
    $game_variables[2] = x      #set canoe x coord
    $game_variables[3] = y      #set canoe y coord
    @through = true
    move_forward
    @through = false     Â
   Â
   elsif $game_switches[2] == true  #getting off boat
    boat = $game_map.events[2]    #get boat event
    boat.moveto(x, y)        #move to player's x, y coords    Â
    $game_switches[2] = false    #Boat Off  Â
    $game_variables[4] = x      #set boat x coord
    $game_variables[5] = y      #set boate y coord Â
    @through = true
    move_forward
    @through = false         Â
   Â
   elsif $game_switches[3] == true  #getting off dragon
    dragon = $game_map.events[3]   #get dragon event
    dragon.moveto(x, y)       #move to player's x, y coords    Â
    $game_switches[3] = false    #Dragon Off  Â
    $game_variables[6] = x      #set dragon x coord
    $game_variables[7] = y      #set dragon y coord    Â
   end
  Â
   # get off vehicle
   actor_restore
 Â
   # reset terrain
   $game_variables[1] = 0     Â
 Â
   # play walking music
   Audio.bgm_play("Audio/BGM/044-Positive02", 100, 100) #play music
  Â
   $game_player.refresh Â
   $game_map.refresh  Â
 Â
  end
Â
 end
Â
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
  in_vehicle_alias
  # if not on ground terrain, check for boat exit
  if $game_variables[1] != 0
   if Input.trigger?(Input::C)
    exit_vehicle
   end Â
  end
 end
Â
end
Â
Add An Additional Vehicle
1. Create a switch for your new vehicle. Call it "using vehicle" (replace vehicle with the name of your vehicle).
2. Create two variables for your vehicle. Call them "vehicle x" and "vehicle y" (replace vehicle with the name of your vehicle).
3. Add an event on your map for your new vehicle. Set it up to look like the other vehicle events. Modify the switches on the event so that they are for your vehicle, not the dragon, canoe, or boat vehicle. Modify the script call in the event so that it is for your vehicle. For example:
Code:
Â
$game_player.enter_vehicle("hovercraft")
Â
4. Put your vehicle sprite in your project's "characters" folder. Make sure that the name of the vehicle is exactly what you specified in step 3. For example, hovercraft.png
5. Get a peice of paper and write down the slot numbers for your switch, your variables, and the event you created for your vehicle. You will need to reference them later in your code.
6. Open the script editor and go to the Vehicle Script section.
7. In def check_terrain, add a new if statement for your vehicle. For example:
Code:
Â
  @state = true if @vehicle == 4 && @terrain == 5  #hovercraft & swamp
Â
8. In def enter_vehicle, add the switch you created for your vehicle to the list. For example:
Code:
Â
  $game_switches[283] = false   #turn off the "using hovercraft" switch
Â
9. In def enter_vehicle, add a new if statement for your vehicle. For example:
Code:
Â
  elsif type == "hovercraft"
   $game_variables[1] = 5    #set terrian
   $game_switches[4] = true   #Hovercraft On Â
   Audio.bgm_play("Audio/BGM/045-Positive03", 100, 100)
Â
10. In def exit_vehicle, add a new if statement for your vehicle. For example:
Code:
Â
   elsif $game_switches[4] == true  #getting off hovercraft
    dragon = $game_map.events[4]  #get hovercraft event
    dragon.moveto(x, y)         #move to player's x, y coords    Â
    $game_switches[4] = false     #turn "using hovercraft" off  Â
    $game_variables[8] = x       #set hovercraft x coord
    $game_variables[9] = y       #set hovercraft y coord  Â
Â
Credits
SephirothSpawn: I made this script after studying SephirothSpawn's (mr. talented!) vehicle script.
DerVVulfman: Enhancing the system!
Bugs
If you find a bug, let me know! I'm crazy busy right now, but I will try to fix any problems. Or, if an advanced scripter wants to take over this project, feel free to do so (again, i'm crazy busy with work). There are some gotchas with this system:
1. Don't use terrain flags on any map but your world map. (if you do, put an if statement in the code so that the vehicle system only works with your world map.
2. If you use a tileset background for an event on your world map, your vehicle will go over it. Use an empty character sprite if you run into problems.