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