Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Enter Vehicles v1.1 (Updated), Enter vehicles while riding them ...
originalwij
post Jun 9 2009, 08:58 PM
Post #1


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




Enter Vehicles

Version: 1.1
Author: OriginalWij
Release Date:6/13/2009

Introduction:
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 vehicle

Features:
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


Customization
All customizable options are at the top of the script

Compatibility
Aliases a few methods, but doesn't overwrite any, so it should have high compatibility

Screenshot
None

Script
CODE

#==============================================================================
# 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


DEMO
v1.1
Demo

FAQ
Comments and suggestions for improvement/next version welcome.

Terms and Conditions
Free to use. Please credit me.

Credits
Me


__________________________




Go to the top of the page
 
+Quote Post
   
Octople Threat
post Jun 9 2009, 10:06 PM
Post #2


Level 18
Group Icon

Group: Revolutionary
Posts: 368
Type: None
RM Skill: Undisclosed




Very cool. Another great script! Keep it up, I'm greedy and I want more of your scripts. thumbsup.gif


__________________________
[Show/Hide] Truth be told...
I'm mostly a databaser... O.o

[Show/Hide] Support thingies...
Go to the top of the page
 
+Quote Post
   
Lord Moe
post Jun 9 2009, 10:20 PM
Post #3


Level 3
Group Icon

Group: Member
Posts: 43
Type: None
RM Skill: Undisclosed




I've been waiting so long for this script! THANK YOU!
Go to the top of the page
 
+Quote Post
   
Yanfly
post Jun 9 2009, 10:38 PM
Post #4


Level 19
Group Icon

Group: Revolutionary
Posts: 384
Type: None
RM Skill: Undisclosed




This is really cool. Good job yet again! =D
Is there the possibility adding a feature to change different maps after different events occur? (for instance, in FF9, you'd switch airships a billion times and there'd be a different bridge each time)


__________________________
Go to the top of the page
 
+Quote Post
   
N2Y
post Jun 10 2009, 01:29 AM
Post #5


Level 4
Group Icon

Group: Member
Posts: 49
Type: Event Designer
RM Skill: Advanced




Sweet! It works perfectly.

Basically you can make a whole airship with tons of maps that you can walk through. Great job!


__________________________
Go to the top of the page
 
+Quote Post
   
Learwolf
post Jun 12 2009, 05:00 PM
Post #6


Level 3
Group Icon

Group: Member
Posts: 35
Type: None
RM Skill: Beginner




I've been searching for a script like this for a fairly long time. It works flawlessly!
My only question is (if riding the airship for example) how to teleport back to the map you were driving your airship on.


__________________________
-Lear
Go to the top of the page
 
+Quote Post
   
FireRMVX
post Jun 12 2009, 05:14 PM
Post #7


Level 5
Group Icon

Group: Member
Posts: 60
Type: Mapper
RM Skill: Intermediate




not wat i was looking for, i was hoping it would be like a final fantasy ten airship kinda thing, where u get in, or maybe i can make a map! HAHA, i figured it out!


__________________________
If you can read this, you passed kindergarten.

The following sentence is true. The previous sentance is false. This sentance is a lie
Parllexes rule!

Personality:
Others see you as fresh, lively, charming, amusing, practical, and always interesting; someone who's constantly in the center of attention, but sufficiently well-balanced not to let it go to their head. They also see you as kind, considerate, and understanding; someone who'll always cheer them up and help them out.

Last words:
GET THIS THING OFF ME!!


Gangster name:
Scrappy

AND LASTLY...
I
AM
A
DARK
ANGEL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**Updated stuff**

[Show/Hide] Siggy Stuff



[u][img]
http://www.runwithgod.com/romans12/images/...b3eb789e9d2.jpg

[/img]








Most importantly children:

[/u
]
Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 12 2009, 06:27 PM
Post #8


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




QUOTE (Learwolf @ Jun 12 2009, 08:00 PM) *
I've been searching for a script like this for a fairly long time. It works flawlessly!
My only question is (if riding the airship for example) how to teleport back to the map you were driving your airship on.

oops, my bad ohmy.gif
use: $scene.return_to_world to return to the vehicle

This post has been edited by originalwij: Jun 12 2009, 06:37 PM


__________________________




Go to the top of the page
 
+Quote Post
   
Learwolf
post Jun 12 2009, 06:30 PM
Post #9


Level 3
Group Icon

Group: Member
Posts: 35
Type: None
RM Skill: Beginner




QUOTE (originalwij @ Jun 12 2009, 10:27 PM) *
QUOTE (Learwolf @ Jun 12 2009, 08:00 PM) *
I've been searching for a script like this for a fairly long time. It works flawlessly!
My only question is (if riding the airship for example) how to teleport back to the map you were driving your airship on.

check out the demo, that will answer your question

D'oh! I don't know why I didn't do that. Sorry, and thanks! (its been a long day sweat.gif )


__________________________
-Lear
Go to the top of the page
 
+Quote Post
   
originalwij
post Jun 13 2009, 09:30 AM
Post #10


... 42 ...
Group Icon

Group: Revolutionary
Posts: 214
Type: Scripter
RM Skill: Masterful




Updated to v1.1! (see original post)


__________________________




Go to the top of the page
 
+Quote Post
   
mech94
post Jul 7 2009, 11:01 AM
Post #11



Group Icon

Group: Member
Posts: 4
Type: Developer
RM Skill: Beginner




Where do you put $scene.return_to_world
Go to the top of the page
 
+Quote Post
   
Shanghai
post Jul 7 2009, 05:41 PM
Post #12


Level 31
Group Icon

Group: Revolutionary
Posts: 747
Type: Developer
RM Skill: Skilled




In an event.

Third tab, bottom where it says Advanced > Script...


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 04:13 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker