RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA] Boat/Ship Passability for Events

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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


Code: [Select]
#==============================================================================
#    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


  • modern algebra

Support


Please post in this topic at RMRK for support.

*
Rep: +0/-0Level 83
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.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
No, but that would not be a terribly difficult script to write. I'll see what I can do once I find the time.

*
Rep: +0/-0Level 83
Thank you much!

**
Rep: +0/-0Level 64
RMRK Junior
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.
« Last Edit: April 16, 2012, 05:30:01 AM by sbethune81 »

*
Rep: +0/-0Level 49
RMRK Junior
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.
« Last Edit: December 29, 2012, 10:41:23 AM by Incubex »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
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:
Code: [Select]
$game_player.in_boat?

*
Rep: +0/-0Level 49
RMRK Junior
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

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I'm happy that I could be of service.