Enter Vehicles
Version: 1.1Author: OriginalWijRelease Date:6/13/2009Introduction:This script allows you to enter vehicles while riding them.
(Teleport to another map and back)
NOTE: I forget to mention, use $scene.return_to_world to return to the vehicleFeatures:v1.0
- Enter vehicles while riding them
- Can enable/disable the ability to enter all 3 vehicles
- Can set the Map ID, X, Y, and Facing Direction of the teleport points (inside the vehicles)
v1.1
- Added option to define the button used to enter the vehicle
- Added option to define a sound to play when entering vehicle
CustomizationAll customizable options are at the top of the script
CompatibilityAliases a few methods, but doesn't overwrite any, so it should have high compatibility
ScreenshotNone
ScriptCODE
#==============================================================================
# Enter Vehicle (While Driving)
#==============================================================================
# Author : OriginalWij
# Version : 1.1
#==============================================================================
#==============================================================================
# v1.0
# - Initial release
# v1.1
# - Added option to define button used
# - Added option to define sound for button
#==============================================================================
#==============================================================================
# Config
#==============================================================================
module VEHICLE
# Button to go inside vehicle
BUTTON = Input::B
# Sound to play when above button is pressed
SOUND = 'AUDIO/SE/Decision2'
VOLUME = 100
PITCH = 100
# Go inside airship?
AIRSHIP = true
# Map coordinates of airship interior (teleport point)
AIR_MAP = 2 # Map ID
AIR_X = 8 # X coordinate
AIR_Y = 8 # Y coordinate
# Direction to face after teleporting to inside the airship
# (0 = Retain, 2 = Down, 4 = Left, 6 = Right, 8 = Up)
AIR_DIR = 4
# Go inside ship?
SHIP = true
# Map coordinates of ship interior (teleport point)
SHIP_MAP = 3 # Map ID
SHIP_X = 8 # X coordinate
SHIP_Y = 8 # Y coordinate
# Direction to face after teleporting to inside the ship
# (0 = Retain, 2 = Down, 4 = Left, 6 = Right, 8 = Up)
SHIP_DIR = 4
# Go inside boat?
BOAT = false
# Map coordinates of boat interior (teleport point)
BOAT_MAP = 4 # Map ID
BOAT_X = 8 # X coordinate
BOAT_Y = 8 # Y coordinate
# Direction to face after teleporting to inside the boat
# (0 = Retain, 2 = Down, 4 = Left, 6 = Right, 8 = Up)
BOAT_DIR = 4
end
#==============================================================================
# NOTE: Use: '$scene.return_to_world' to return to the vehicle when "inside"
#==============================================================================
#==============================================================================
# Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# Public Instance Variables (Added)
#--------------------------------------------------------------------------
attr_accessor :vehicle_hold
#--------------------------------------------------------------------------
# Initialize (Mod)
#--------------------------------------------------------------------------
alias ow_vehicle_initialize initialize unless $@
def initialize
ow_vehicle_initialize
@vehicle_hold = []
end
#--------------------------------------------------------------------------
# Get Vehicle Coordinate Hold (New)
#--------------------------------------------------------------------------
def vehicle_hold
return @vehicle_hold
end
#--------------------------------------------------------------------------
# Set Vehicle Coordinate Hold (New)
#--------------------------------------------------------------------------
def vehicle_hold=(hold)
@vehicle_hold = hold
end
end
#==============================================================================
# Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# Set direction (New)
#--------------------------------------------------------------------------
def direction=(facing)
@direction = facing
end
#--------------------------------------------------------------------------
# Get Vehicle Type (New)
#--------------------------------------------------------------------------
def vehicle_type
return @vehicle_type
end
#--------------------------------------------------------------------------
# Exit Vehicle (New)
#--------------------------------------------------------------------------
def exit_vehicle
$game_map.vehicles[@vehicle_type].get_off
if in_airship?
@direction = 2
else
force_move_forward
@transparent = false
end
@vehicle_getting_off = true
@move_speed = 4
@through = false
make_encounter_count
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# Include (New)
#--------------------------------------------------------------------------
include VEHICLE
#--------------------------------------------------------------------------
# Determine if Menu is Called due to Cancel Button (Mod)
#--------------------------------------------------------------------------
alias ow_vehicle_update_call_menu update_call_menu unless $@
def update_call_menu
if $game_player.in_vehicle? and Input.trigger?(BUTTON)
type = $game_player.vehicle_type
if (type == 0 and BOAT) or (type == 1 and SHIP) or (type == 2 and AIRSHIP)
Audio.se_play(SOUND, VOLUME, PITCH)
go_inside
return
end
end
ow_vehicle_update_call_menu
end
#--------------------------------------------------------------------------
# Go Inside Vehicle (New)
#--------------------------------------------------------------------------
def go_inside
fadeout(30)
hold = []
hold[0] = $game_map.map_id
hold[3] = hold[4] = $game_player.direction
type = $game_player.vehicle_type
$game_player.exit_vehicle
for i in 1..60
update_basic
$game_player.update
end
hold[1] = $game_player.x
hold[2] = $game_player.y
hold[3] = (5 - (hold[3] / 2)) * 2 if type < 2
$game_system.vehicle_hold = hold
case type
when 0
$game_player.reserve_transfer(BOAT_MAP, BOAT_X, BOAT_Y, BOAT_DIR)
when 1
$game_player.reserve_transfer(SHIP_MAP, SHIP_X, SHIP_Y, SHIP_DIR)
when 2
$game_player.reserve_transfer(AIR_MAP, AIR_X, AIR_Y, AIR_DIR)
end
update_transfer_player
fadein(30)
end
#--------------------------------------------------------------------------
# Return To World Map (New)
#--------------------------------------------------------------------------
def return_to_world
fadeout(30)
hold = $game_system.vehicle_hold
$game_player.reserve_transfer(hold[0], hold[1], hold[2], hold[3])
update_transfer_player
$game_player.get_on_vehicle
for i in 1..30
update_basic
$game_player.update
end
$game_player.direction = hold[4]
for i in 1..30
update_basic
$game_player.update
end
fadein(30)
end
end
DEMOv1.1
DemoFAQComments and suggestions for improvement/next version welcome.
Terms and ConditionsFree to use. Please credit me.
CreditsMe