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.
Boat/Ship Passability for Events

0 Members and 2 Guests 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.1
Author: modern algebra
Date: March 5, 2008

Description


This script allows you to set events as boats or ships, and thus forces them to adhere to the passability of boats or ships. The most obvious use for it is for making a boat or ship event with random movement. Or really, any boat or ship events

Features

  • *NEW* in 1.1: Boats and Ships are now identified in comments instead of by the name
  • Easy identification of a Boat or Ship event
  • Allows for the event's movement through water

Instructions

Basically, all you need to do to identify any given event as being a ship or a boat, just type \boat or \ship (captialization doesn't matter) in a comment that you place as the very first line of the page of the event. If you do something like \boat\ShIp, it will identify as ship since ship has priority over boat. I would do airship as well, but it seems to me that clicking the Passage Box would be enough. With that in mind, I should clarify - if you set a boat or ship event with passage, then it will still be restricted from moving onto land or into the deep water or whatever - it will just be able to move onto other events in the water. I did it that way because I figure that if you want an event to move anywhere, why would you bother identifying it as a ship or boat?

Script


Code: [Select]
#========================================================================
#  Boat/Ship Passability for Events
#  Version: 1.1
#  Author: modern algebra
#  Date: March 5, 2008
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Instructions:
#    Basically, identify a ship or boat event by putting \boat or \ship somewhere in the name of
#    the event.
#========================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#      aliased method - initialize
#      super methods changed - passable?
#========================================================================

class Game_Event < Game_Character
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Object Initialization
  #     map_id : map ID
  #     event  : event object (RPG::Event)
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_boat_random_movement_init initialize
  def initialize (map_id, event)
    # Initialize boat/ship variables
    @boat_object, @ship_object = false, false
    # Run Original Method
    modalg_boat_random_movement_init (map_id, event)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Setup
  #    new_page : the active page
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modalg_boat_random_movement_stp setup
  def setup(new_page)
    if new_page != nil
      first_command = new_page.list[0]
      # If a Comment
      if first_command.code == 108
        @boat_object = first_command.parameters[0][/\\BOAT/i] != nil
        @ship_object = first_command.parameters[0][/\\SHIP/i] != nil
      end
    end
    # Run Original Method
    modalg_boat_random_movement_stp (new_page)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Passable?
  #       x : the x coordinate of the square being tested
  #       y : the y coordinate of the square being tested
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def passable? (x, y)
    return false if collide_with_characters? (x, y) unless (@through || debug_through?)
    if @ship_object
      return $game_map.ship_passable? (x, y)
    elsif @boat_object
      return $game_map.boat_passable? (x, y)
    end
    return super (x, y)
  end
end

Credit


  • modern algebra

Thanks

  • ahref, for the request

Support


Just post in this topic.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:54:59 PM by Modern Algebra »

*
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
Updated to Version 1.1. It now reads the first comment of a page, rather than the name. This is better for two reasons: (a) You can retrieve the name of an event without it being corrupted by the code and (b) you can set it's special passability by page, thus if an event is a ship on one page, it doesn't need to be on another page.

*
Resident Cloud
Rep:
Level 91
oo cool.

hover boat here i come :D

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
 :lol:
This is useful!
Especially for meeee~
Be kind, everyone you meet is fighting a hard battle.

*
Resident Cloud
Rep:
Level 91
ill post the port script when i fix it so the event command "get on.off vehicle" still works even with the script in :D