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.
Vehicle Landing Restrictions

0 Members and 2 Guests are viewing this topic.

*
Resident Cloud
Rep:
Level 91
Vehicle Landing Restrictions
Part of ahref's pirate game template(unreleased :()
Version: 1.00
Author: ahref
Date: April 10, 2008

Version History

  • Version 1 - initial release
Planned Future Versions

  • Version 1.5 - Aliased methods possible first comment support and ability to force player from ship

Description

This script restricts where a player can exit their boats an ships. they can only exit their vehicles at specified events whose names contain "port". THIS DOES NOT WORK WITH AIRSHIPS.

Features

  • case insensitive will match port,Port,PORT

Instructions
paste above main and name any event you want a player to be able to land at with port. eg "Port Royal"

Script


Code: [Select]
#===============================================================================
# Landing Restrictions - RMVX
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Written by ahref
# 10/4/08
# Version 1.00
#===============================================================================
# This script Changes the get_off_vehcile function so players can only
# exit ships and boats if the script determines that the vehicle is at a port
# using the name of the event infront of it.
#
# The script will allow the player to leave their ship if any of the following
# are found in the event name:
# * Port
# * PORT
# * port
#===============================================================================

===============================================================================
# ** Game_Player
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#      new method : at_port
#      edit to method : get_off_vehicle
#===============================================================================
class Game_Player < Game_Character
  #-----------------------------------------------------------------------------
  # Checks if player is at a port
  #-----------------------------------------------------------------------------
  def at_port(x,y)
    event  = $game_map.events_xy (x, y)
    if event.empty?
      return false
    else
      if (event[0].name =~ /\PORT/i) !=nil
        return true
      else
        return false
      end
    end
  end
  #-----------------------------------------------------------------------------
  # Rewritten to include new method
  #-----------------------------------------------------------------------------
  def get_off_vehicle
    if in_airship?                                # Airship
      return unless airship_land_ok?(@x, @y)      # Can't land?
    else                                          # Boat/ship
      front_x = $game_map.x_with_direction(@x, @direction)
      front_y = $game_map.y_with_direction(@y, @direction)
      return unless at_port(front_x, front_y)   # Can't touch land?
    end
    $game_map.vehicles[@vehicle_type].get_off     # Get off processing
    if in_airship?                                # Airship
      @direction = 2                              # Face down
    else                                          # Boat/ship
      force_move_forward                          # Move one step forward
      @transparent = false                        # Remove transparency
    end
    @vehicle_getting_off = true                   # Start getting off operation
    @move_speed = 4                               # Return move speed
    @through = false                              # Passage OFF
    @walking_bgm.play                             # Restore walking BGM
    make_encounter_count                          # Initialize encounter
  end
end

#===============================================================================
# ** Game_Event
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Summary of Changes:
#      new method : name returns event name @D
#===============================================================================
class Game_Event < Game_Character
  #-----------------------------------------------------------------------------
  # Returns the name of an event
  #-----------------------------------------------------------------------------
  def name
    return @event.name
  end
end


#=============================================================================== 
# Version 1.00
# 10/4/08
# Written by ahref
#===============================================================================
# Landing Restrictions - RMVX
#===============================================================================

Credit

  • ahref
  • thanks to Modern Algebra and Zeriab for a few pointers :D

Support

ahref@irc.rmrk.net

Known Compatibility Issues
This may cause issues with other map scripts let me know if you find anything

Demo

http://www.sendspace.com/file/vmejqg

Author's Notes

Due to the way this is written the get on/off event command doesnt work. Then again ive never been able to get it to work even with this script.

id recomend you dont teleport players whilst there on a vehicle even withou this script it doesnt work ill find/write a workaround soon.

« Last Edit: April 26, 2008, 03:50:08 PM by ahref »

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
Looking forward to the pirate game template lol
There doesn't seem to be bugs so far. :)
Be kind, everyone you meet is fighting a hard battle.

*
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
It looks pretty good. I would say that it is worth your while to try and alias those methods though, especially the one in Game_Interpreter.


But aside from that, it is a nice, clean script. Good job ahref.

* Transports topic

By the way, you have some weird centering going on with your topic :3

Also, you have a Thanks heading with nothing under it and a thanks bulletin under Credit :P
« Last Edit: April 11, 2008, 07:16:32 AM by modern algebra »

*
Resident Cloud
Rep:
Level 91
ill take a look.

also for aliasing every tutorial i see about them is written by someone with less then perfect english. ill keep looking :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
Hey, don't make fun of my english  :mad:

http://rmrk.net/index.php/topic,25550.0.html

:P I don't know how helpful it will be.

*
Resident Cloud
Rep:
Level 91
your english is fine :D

**
Rep: +0/-0Level 83
That one guy in that one place.
Nice script. :D

noticed one problem, its an easy fix though, line 19 is missing the # at the beginning.
Hmm.... rm2k isn't compatible with vista? Looks like I'll go to rmvx... Scripting?
Oh sweet, I get to add new stuff! OH DEAR GOD! *head explodes*
CLICKY!
MyMiniCity