Hi im using a different script you wrote a while back when I requested it and I need an airship but it always says "you cant place it here" or something. I cant get this new script to work right. Is there a common even required for the item to call it? This is the version I am using.
CODE
module CONFIG
#----------------------------------------------------------------------------
# Configuration Settings
#----------------------------------------------------------------------------
#World Map map id to control when the airship can be called
WORLD_MAP_ID = 1
#Change these to show a different animation using the database id
BOAT_ANIMATION_ID = 75
SHIP_ANIMATION_ID = 75
AIRSHIP_ANIMATION_ID = 75
#Change this to alter the error message
B_ERROR_TEXT = ['',' You cannot call the boat from here']
S_ERROR_TEXT = ['',' You cannot call the ship from here']
A_ERROR_TEXT = ['',' You cannot call the airship from here']
end
class Vehicle_Caller
def initialize
@vehicle_loc = nil
end
def show_error_message(message)
unless $game_message.busy
$game_message.position = 1
$game_message.texts = message
$game_message.visible = true
end
end
def call_boat
px = $game_player.x
py = $game_player.y
#Check the tiles surrounding the player.
#and see if the boat can pass through the tile.
#If it can, place it there.
if $game_map.boat_passable?(px, py - 1) #up
@vehicle_loc = [px, py - 1]
elsif $game_map.boat_passable?(px + 1, py) #right
@vehicle_loc = [px + 1, py]
elsif $game_map.boat_passable?(px, py + 1) #down
@vehicle_loc = [px, py + 1]
elsif $game_map.boat_passable?(px - 1, py) #left
@vehicle_loc = [px - 1, py]
else
@vehicle_loc = nil
end
if @vehicle_loc != nil
#Set the boat location
$game_map.vehicles[0].set_location(
$game_map.map_id, @vehicle_loc[0], @vehicle_loc[1])
$game_map.vehicles[0].animation_id = CONFIG::BOAT_ANIMATION_ID
else
#nowhere to put the boat, show an error message
show_error_message(CONFIG::B_ERROR_TEXT)
end
end
def call_ship
px = $game_player.x
py = $game_player.y
#Check the tiles surrounding the player.
#and see if the ship can pass through the tile.
#If it can, place it there.
if $game_map.ship_passable?(px, py - 1) #up
@vehicle_loc = [px, py - 1]
elsif $game_map.ship_passable?(px + 1, py) #right
@vehicle_loc = [px + 1, py]
elsif $game_map.ship_passable?(px, py + 1) #down
@vehicle_loc = [px, py + 1]
elsif $game_map.ship_passable?(px - 1, py) #left
@vehicle_loc = [px - 1, py]
else
@vehicle_loc = nil
end
if @vehicle_loc != nil
#Set the ship location
$game_map.vehicles[1].set_location(
$game_map.map_id, @vehicle_loc[0], @vehicle_loc[1])
$game_map.vehicles[1].animation_id = CONFIG::SHIP_ANIMATION_ID
else
#nowhere to put the ship, show an error message
show_error_message(CONFIG::S_ERROR_TEXT)
end
end
def call_airship
px = $game_player.x
py = $game_player.y
#if this is the world map...
if $game_map.map_id == CONFIG::WORLD_MAP_ID
#...check the tiles surrounding the player.
#if a tile is passable when the 0x01 flag is passed
#to the function, the player can walk there. If that is true,
#we then check to see if the airship could land there.
#After that, make sure that there is no event on that tile.
#If these conditions are all true, place it there.
if $game_map.passable?(px, py - 1, 0x01) and #up
$game_map.airship_land_ok?(px, py - 1)and #can land
$game_map.events_xy(px, py - 1) == [] #no event
@vehicle_loc = [px, py - 1]
elsif $game_map.passable?(px + 1, py, 0x01) and #right
$game_map.airship_land_ok?(px + 1, py)and #can land
$game_map.events_xy(px + 1, py) == [] #no event
@vehicle_loc = [px + 1, py]
elsif $game_map.passable?(px, py + 1, 0x01) and #down
$game_map.airship_land_ok?(px, py + 1)and #can land
$game_map.events_xy(px, py + 1) == [] #no event
@vehicle_loc = [px, py + 1]
elsif $game_map.passable?(px - 1, py, 0x01) and #left
$game_map.airship_land_ok?(px - 1, py)and #can land
$game_map.events_xy(px - 1, py) == [] #no event
@vehicle_loc = [px - 1, py]
else
@vehicle_loc = nil
end
else
show_error_message(CONFIG::A_ERROR_TEXT)
return
end
if @vehicle_loc != nil
#Set the airship location
$game_map.vehicles[2].set_location(
$game_map.map_id, @vehicle_loc[0], @vehicle_loc[1])
$game_map.vehicles[2].animation_id = CONFIG::AIRSHIP_ANIMATION_ID
else
#nowhere to put the airship, show an error message
show_error_message(CONFIG::A_ERROR_TEXT)
end
end
end