iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> HungrySnake's VBTP Ver 1.0, Vehcile Back To Place System
Rating 5 V
HungrySnake
post Sep 11 2011, 12:33 PM
Post #1



Group Icon


Type: Coder
Alignment: Chaotic Good




HungrySnake's VBTP V 1.1 - Vehcile Back To Place Version 1.1
by HungrySnake



Introduction:

Hi guys, I just made a Vehcile Back To Place System, which sends the vehcile back
to it's place after the user used it.

How To Use:

This script is not plug-and-play. You got to set it up first before you start using it.

1) Determine which Vehciles are in the map.

2) Determine to which X and Y coordinates they need to transfer after it's used.

3) Make a new event, probarly a parallel process, which switches the switch 20 to ON
(You can always change the Switch_ID in the script)


4) Start playing

Features:

- Transfers the vehcile to a self-specified place in the map.

- Really much options.

- Reset the coordiantes for the vehicles.

- Switch Activated: You can switch the script ON or OFF whenever you want.

No Screenies.

Script:

Spoiler:
CODE
#-------------------------------------------------------------------------#
#                                                                         #
#                            Vehicle Back To Place                        #
#                                                                         #
#                                                                         #
# This snippet sends the vehicle (boat/ship/airship) back to a specified  #
# X and Y coordinate. You can configure the X and Y coordinate beneath.   #
#                                                                         #
# You can change the X,Y and the Map Id anytime in the game               #
# by doing this:                                                          #
#                                                                         #
# > New Event => Advanced => Script...                                    #
# > To Re-Adjust the Airship's location write:                            #
#     air_loc(map_id,x_loc,y_loc)                                         #
#   for the Ship:                                                         #
#     ship_loc(map_id,x_loc,y_loc)                                        #
#   for the Boat                                                          #
#     boat_loc(map_id,x_loc,y_loc)                                        #
# > Click OK                                                              #
#                                                                         #
# Credit:                                                                 #
#                                                                         #
# HungrySnake                                                             #
#                                                                         #
#-------------------------------------------------------------------------#

module VR
  module Config
    
    #-------------------------------------------------------------------------#
    #                                                                         #
    #                             Config Start                                #
    #                                                                         #
    #-------------------------------------------------------------------------#
    
    # If you just want to continue traveling with the vehicle
    # turn the Switch 20 In_Game OFF. You can change the Switch_ID
    # whenever you want. Make Sure when you want to use this script
    # Switch 20 is turned ON.
    
    VBTP_ON_SWITCH_ID = 20 # Switch ID
    
    AIRSHIP_MAP = true # Is there an AirShip in the map?
    MAP_ID_AIR = 1 # Map ID for the AirShip to return
    X_LOC_AIR = 0 # X Loaction for the AirShip to return
    Y_LOC_AIR = 7 # Y Loaction for the AirShip to return
    
    SHIP_MAP = true # Is there a Ship in the map?
    MAP_ID_SHIP = 1 # Map ID for the Ship to return
    X_LOC_SHIP = 14 # X Loaction for the Ship to return
    Y_LOC_SHIP = 8 # Y Loaction for the Ship to return
    
    BOAT_MAP = true # Is there a Boat in the map?
    MAP_ID_BOAT = 1 # Map ID for the Boat to return
    X_LOC_BOAT = 14 # X Loaction for the Boat to return
    Y_LOC_BOAT = 6 # Y Location for the Boat to return
    
  end
end

#-------------------------------------------------------------------------#
#                                                                         #
#                             Config End                                  #
#                                                                         #
#-------------------------------------------------------------------------#

class Game_Interpreter
  
  
  def air_loc(map_id,x,y)
     $game_temp.air_loc = [map_id,x,y]
  end
  
  def ship_loc(map_id,x,y)
     $game_temp.ship_loc = [map_id,x,y]
  end
  
  def boat_loc(map_id,x,y)
    $game_temp.boat_loc = [map_id,x,y]
  end
end

class Game_Player < Game_Character
  include VR::Config
  
  def get_off_vehicle
    if in_airship?                                # Airship
      return unless airship_land_ok?(@x, @y)      # Can't land?
    else                                          # Boat/ship
      front_x = $game_map.x_with_direction(@x, @direction)
      front_y = $game_map.y_with_direction(@y, @direction)
      return unless can_walk?(front_x, front_y)   # Can't touch land?
    end
    $game_map.vehicles[@vehicle_type].get_off     # Get off processing
    wait_count = 1
    if $game_switches[VBTP_ON_SWITCH_ID]
      if AIRSHIP_MAP
        $game_map.airship.set_location($game_temp.air_loc[0],$game_temp.air_loc[1],$game_temp.air_loc[2])
      end
    end
    if in_airship?                                # Airship
      @direction = 2                              # Face down
    else                                          # Boat/ship
      force_move_forward                          # Move one step forward
      @transparent = false                        # Remove transparency
      if $game_switches[VBTP_ON_SWITCH_ID]
        if SHIP_MAP
          $game_map.ship.set_location($game_temp.ship_loc[0],$game_temp.ship_loc[1],$game_temp.ship_loc[2])
        end
      end
      if $game_switches[VBTP_ON_SWITCH_ID]
        if BOAT_MAP
          $game_map.boat.set_location($game_temp.boat_loc[0],$game_temp.boat_loc[1],$game_temp.boat_loc[2])
        end
      end
    end
    @vehicle_getting_off = true                   # Start getting off operation
    @move_speed = 4                               # Return move speed
    @through = false                              # Passage OFF
    @walking_bgm.play                             # Restore walking BGM
    make_encounter_count                          # Initialize encounter
  end
end  

class Game_Temp
  include VR::Config
  
  attr_accessor :air_loc
  attr_accessor :ship_loc
  attr_accessor :boat_loc
  
  alias hsnake_vbtpgt_init initialize unless $@
  def initialize
    @air_loc = [MAP_ID_AIR,X_LOC_AIR,Y_LOC_AIR]
    @ship_loc = [MAP_ID_SHIP,X_LOC_SHIP,Y_LOC_SHIP]
    @boat_loc = [MAP_ID_BOAT,X_LOC_BOAT,Y_LOC_BOAT]
    hsnake_vbtpgt_init
  end
end


FaQ:

Spoiler:
Q: The Vehcile doesn't transfers to it's original place D8.

A: Did u activate Switch 20 IN-GAME? If not, DO IT.

Q: The Vehcile transfers but to a different place =(.

A: Are you sure you did set-up the config:

CODE
    X_LOC_AIR = 0 # X Location for the AirShip to return
    Y_LOC_AIR = 7 # Y Location for the AirShip to return

    X_LOC_SHIP = 14 # X Location for the Ship to return
    Y_LOC_SHIP = 8 # Y Location for the Ship to return

    X_LOC_BOAT = 14 # X Location for the Boat to return
    Y_LOC_BOAT = 6 # Y Location for the Boat to return



Q: If I get off the ship, the boat shows up D:

A:
CODE
AIRSHIP_MAP = false # Is there an AirShip in the map? # << Change to true if there is.
SHIP_MAP = true # Is there a Ship in the map? # << Change to false if there isn't.
BOAT_MAP = false # Is there a Boat in the map? # << Change to true if there is.


Credit:

HungrySnake

This post has been edited by HungrySnake: Jun 28 2012, 08:30 PM


--------------------
Go to the top of the page
 
+Quote Post
   
FenixFyreX
post Sep 11 2011, 03:06 PM
Post #2


I'm on fire 24/7 >:3
Group Icon


Type: Coder
Alignment: Lawful Good




Can you un-center everything? You are going to make your spoilers explode. Also, its just disorienting. Lower the size of the title(font-wise) and this'll be great tongue.gif
Also, please don't repost your submission. It goes into a moderation queue and we will approve it when we get to it. It doesn't help your case to clutter that system.

For your code, you should probably include a map id for the vehicle to return to. Right now, you are assuming that every single map has the coordinates specified in the config. What happens if they don't( like the map is 13x17 and the coordinates are 27x20 )? No more vehicle, lol.
Go to the top of the page
 
+Quote Post
   
King OF RMVX
post Sep 11 2011, 04:01 PM
Post #3



Group Icon


Type: Designer
Alignment: Chaotic Good




Another cool script from you biggrin.gif btw did you see my pm
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: 23rd July 2014 - 12:46 AM

RPGMakerVX.net is an Privacy Policy, Legal.