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
#========================================================================
# 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
Thanks
Support
Just post in this topic.
This script by
modern algebra is licensed under a
Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.