Boat/Ship Passability for Events
Version: 1.0
Author: modern algebra
Date: December 29, 2011
Version History
- <Version 1.0> 2011.12.29 - Original Release
Description
This script simply allows you to set it so that specified events can have the passability of a boat or a ship.
Features
- Easy configuration - a simple code typed into a comment on the first line of the page
- Allows for event movement through water
Instructions
Paste this script into its own slot in the Script Editor, above Main but below Materials.
To set an event with boat or ship passability, simply type \boat or \ship, respectively, into a comment on the first line of the event page. For more details, see the header of the script.
Script
#==============================================================================
# Boat/Ship Passability for Events
# Version: 1.0
# Author: modern algebra (rmrk.net)
# Date: December 29, 2011
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script simply allows you to set it so that specified events can have
# the passability of a boat or a ship.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Paste this script above Main and below Materials.
#
# To set it so that an event has boat or ship passability, just create a
# comment on the first line of the event page and include in it one of the
# following codes:
#
# \boat
# \ship
#
# As you could guess, if you use the \boat code, the event will have the
# passability of a boat, and if you use the \ship code, the event will have
# the passability of a ship.
#==============================================================================
$imported = {} unless $imported
$imported[:MA_BoatShipPassability] = true
#==============================================================================
# ** Game_Event
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - setup_page; map_passable?
# new method - ma_set_boatship_passability
#==============================================================================
class Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Setup Page Settings
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mabspe_stppageseting_3gs7 setup_page_settings
def setup_page_settings(*args, &block)
mabspe_stppageseting_3gs7(*args, &block) # Run Original Method
ma_set_boatship_passability
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set MABSPE Passability
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def ma_set_boatship_passability
@mabspe_passability, i = nil, 0
# Check Initial Comments
while !@list[i].nil? && (@list[i].code == 108 || @list[i].code == 408)
if @list[i].parameters[0][/\\(BOAT|SHIP)/i]
@mabspe_passability = $1.downcase.to_sym
break
end
i += 1
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Map Passable?
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias mabspe_mppassale_5vs4 map_passable?
def map_passable?(x, y, *args, &block)
case @mabspe_passability
when :boat then $game_map.boat_passable?(x, y)
when :ship then $game_map.ship_passable?(x, y)
else
mabspe_mppassale_5vs4(x, y, *args, &block) # Run Original Method
end
end
end
Credit
Support
Please post in this topic at RMRK for support.
Quick question: Can this script be used to make boat/ship ports? I used a script from ahref in VX for this purpose, but it's not compatible in ACE and I don't have the slightest clue as to where I should even start to edit it... I'm trying to port my old project and this is a necessity for it. Thanks in advance.
No, but that would not be a terribly difficult script to write. I'll see what I can do once I find the time.
Thank you much!
Hello, just found your script and it's great. I plan on using it, but I've come up with a question based off your script. Within the pre-packaged scripts of VX ACE, how can I add specific custom tiles that the ship can pass over, say a blank black tile or lava for instance? I don't know much about tilesets, so even if I located the spot to add tiles to the ship's passability setting, I don't know how to refer to them. Thanks for your help.
Sorry for necro posting, but I have a question: What if we want the character to have ship or boat passability?
I have been looking for the longest time for a script that allows my character to swim and this script mirrors that perfectly...for events. I want that to work for my character. I literally have a game HINGING on the character being able to swim without the use of a boat or a ship. All the other Scripts I've come across involve changing the passability of water and using tags.
I am wanting to have it so that you can only get into the water from a dock. You jump in, then get your passability. If you decide to get out of the water, the passability is taken away.
Are you actually using ships and boats elsewhere in the game?
If not, it would be a relatively simple thing to just use the boat for that purpose. What I mean is you could make it so that the vehicle itself has no graphic. At each of these docks, you could have an event which does the following:
@>Set Vehicle Location: Boat, [Square in front of the player]
@>Dive Animation
@>Get On Vehicle
@>Change Vehicle Graphic: Graphic of Player swimming
Then all you would need to have is a parallel process common event which changes the graphic of the boat back to nothing and moves it to an inaccessible location when the player is not in the Boat, which you can do by Conditional Branch - Script: $game_player.in_boat?
OMG THANK YOU
I did have to make a slight alteration to it though. The boat will not let you board it if you are standing right on top of it. So, I had the boat appear one square below where the player jumps into the water. For anyone else who is doing this, I have a picture below. The dock acts as a jumping board and a access point back to land and everything checks out. Thank you SO much modern algebra ;D
I'm happy that I could be of service.