Save-Point
KTrespass VX - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: KTrespass VX (/thread-13613.html)



KTrespass VX - kyonides - 06-27-2026

KTrespass VX

by Kyonides

Introduction

Let the player do crazy stuff like slipping into a pond or climbing a mountain (no batteries nor UI included) by just owning a very specific item.

Everything is handled by the very short KTrespass module. Just a custom note in the item's notebox:

Code:
<passable terrain: 0-63>

NOTES:
  • The VX tileset is composed of very minuscule pieces so you are in need of setting a tile ID range to make the script work properly.
  • You will eventually need to create events that include a special script call in order to retrieve a tile ID.

The Script

Code:
# * KTrespass VX * #
#   Scripter : Kyonides
#   v1.0.1 - 2026-06-27

# Let the player slip into a pond or climb a mountain (no UI included)
# if the party owns a specific item.
# Just leave a note in the item's notebox. Replace TileID with a number.
# You must set ranges because the tileset is composed of very tiny pieces.
#   <passable terrain: TileID1-TileID2>

# * Helpful Script Call * #
# - Get the Next Tile IDs (From Bottom to Top) During Playtest:
# x, y, dir = $game_player.x_y_dir
# $game_map.next_tile_id?(x, y, dir)

module KTrespass
  NOTE_TAG = /<passable terrain: (.*)>/i
end

module RPG
  class BaseItem
    def item?
      false
    end
  end

  class Item
    def item?
      true
    end
  end
end

class Game_Party
  alias :kyon_trespass_gm_pty_init :initialize
  alias :kyon_trespass_gm_pty_gain_item :gain_item
  def initialize
    kyon_trespass_gm_pty_init
    @terrain_items = {}
  end

  def gain_item(item, n, include_equip=false)
    kyon_trespass_gm_pty_gain_item(item, n, include_equip)
    refresh_item_terrain_tags(item) if item.item?
  end

  def refresh_item_terrain_tags(item)
    item_id = item.id
    n = @items[item_id] || 0
    if n > 0 and !@terrain_items.has_key?(item_id)
      item.note[KTrespass::NOTE_TAG]
      return unless $1
      range = $1.scan(/(\d+)-(\d+)/).flatten
      range.map! {|n| n.to_i }
      range = Range.new(*range)
      @terrain_items[item_id] = range
    else
      @terrain_items.delete(item_id)
    end
  end

  def terrain_items
    @terrain_items ||= {}
  end

  def item_has_terrain_id?(terrain_id)
    @terrain_items.values.flatten.include?(terrain_id)
  end
end

class Game_Map
  def terrain_tile_id?(x, y)
    tile_ids = $game_party.terrain_items.values.flatten
    for i in [2, 1, 0]
      tile_id = @map.data[x, y, i]
      for range in tile_ids
        return true if range.include?(tile_id)
      end
    end
    return false
  end

  def next_tile_id?(x, y, dir)
    x += dir == 4 ? -1 : dir == 6 ? 1 : 0
    y += dir == 2 ? 1 : dir == 8 ? -1 : 0
    tile_ids = []
    for i in [2, 1, 0]
      tile_ids << @map.data[x, y, i]
    end
    tile_ids.reverse!
    print tile_ids.join("\n")
  end
end

class Game_Player
  def map_passable?(x, y)
    case @vehicle_type
    when 0  # Boat
      return $game_map.boat_passable?(x, y)
    when 1  # Ship
      return $game_map.ship_passable?(x, y)
    when 2  # Airship
      return true
    else    # Walking
      pass = $game_map.passable?(x, y)
      pass = $game_map.terrain_tile_id?(x, y) unless pass
      return pass
    end
  end

  def x_y_dir
    [@x, @y, @direction]
  end
end

Terms & Conditions

Under MIT License.
That's it! Tongue sticking out