Save-Point
KTrespass XP - 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 XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: KTrespass XP (/thread-13612.html)



KTrespass XP - kyonides - 06-27-2026

KTrespass XP

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 add an item ID to the Hash and set its corresponding Array of Terrain Tags, and that's it! :D

NOTE: Game_Player#passable? method has been overwritten on purpose to keep the script as simple as possible.

The Script

Code:
# * KTrespass XP * #
#   Scripter : Kyonides
#   v1.0.1 - 2026-06-26

# Let the player slip into a pond or climb a mountain (no UI included)
# if the party owns a specific item.
# Just configure the TERRAIN_ITEMS Constant below accordingly.

module KTrespass
  TERRAIN_ITEMS = {} # Better leave this line alone!
# Terrain Tags: Never include 0 in the array!
# [ItemID] = [Tag1, etc.]
  TERRAIN_ITEMS[26] = [1,2]
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_id, n)
    kyon_trespass_gm_pty_gain_item(item_id, n)
    tags = KTrespass::TERRAIN_ITEMS[item_id]
    refresh_item_terrain_tags(item_id, tags) if tags
  end

  def refresh_item_terrain_tags(item_id, tags)
    n = @items[item_id] || 0
    if n > 0
      @terrain_items[item_id] ||= tags
    else
      @terrain_items.delete(item_id)
    end
  end

  def terrain_items
    @terrain_items ||= {}
  end

  def item_has_terrain_tag?(target)
    @terrain_items.values.flatten.include?(target)
  end
end

class Game_Player
  def passable?(x, y, d)
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    return false if !$game_map.valid?(new_x, new_y)
    return true if $DEBUG and Input.press?(Input::CTRL)
    return true if @through
    pass_now = $game_map.passable?(x, y, d, self)
    pass_next = $game_map.passable?(new_x, new_y, 10 - d)
    if $game_party.terrain_items.empty?
      return false if !pass_now or !pass_next
    else
      if !pass_now
        tag = $game_map.terrain_tag(x, y)
        return false if tag == 0 or !$game_party.item_has_terrain_tag?(tag)
      end
      if !pass_next
        tag = $game_map.terrain_tag(new_x, new_y)
        return false if !$game_party.item_has_terrain_tag?(tag)
      end
    end
    for event in $game_map.events.values
      if event.x == new_x and event.y == new_y
        unless event.through
          return false if self != $game_player
          return false if !event.character_name.empty?
        end
      end
    end
    if @x == new_x and @y == new_y
      return true if @through or
      return false if !@character_name.empty?
    end
    true
  end
end

Terms & Conditions

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