Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Script Call

Is there a script call to change the passage and priority of things on a map?  So, let's say I wanted the player to walk on water, but only when a certain event is activated.  The event would call a script that would let said player walk on water.  Is there a script call for that (or an event)?  Thanks!
 

khmp

Sponsor

RPGS you can do it during runtime too. :wink:

Code:
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Walk On Everything
  #--------------------------------------------------------------------------
  def walk_on_everything
    # Create our old passsages Table.
    @old_passages = Table.new(@passages.xsize)
    # Loop through all the passages and manipulate appropriately.
    for i in 0...@passages.xsize
      # Copy the old passages.
      @old_passages[i] = @passages[i]
      # Just a check
      next if @passages[i].nil?
      # "And" the flag with zero to turn it off.
      @passages[i] &= 0
      #-------------
      # Flags
      #-------------
      #0x01: Cannot move down.
      #0x02: Cannot move left.
      #0x04: Cannot move right.
      #0x08: Cannot move up.
      #0x40: Bush flag.
      #0x80: Counter flag.
    end
  end
  #--------------------------------------------------------------------------
  # * Restore The Passages
  #--------------------------------------------------------------------------
  def restore_passages
    return if @old_passages.nil?
    @passages = @old_passages.dup
  end
end

I'm not sure how to actually check for "water". Maybe someone else can expound on what I did, or has a different approach.

To install this script just create an empty section above main and paste in this code for more in depth instructions visit the RGSS Support FAQ.

To turn on the ability of "Walking on Water".
Code:
$game_map.walk_on_everything

To remove the ability.
Code:
$game_map.restore_passages

Good luck with it AbyssalLord! :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top