- 16
- Posts
- 6
- Years
- Seen Oct 13, 2022
Not sure if somebody already noticed this:
surf_bug1
surf_bug2
I assume that this shouldn't happen.
The player can surf independently of a tile being above the water.
Also, events in the water can walk through it.
Here is a provisional fix I made that seems satisfactory:
This is far from a perfect fix, but the idea is to point out a future hotfix regarding this.
surf_bug1
surf_bug2
I assume that this shouldn't happen.
The player can surf independently of a tile being above the water.
Also, events in the water can walk through it.
Here is a provisional fix I made that seems satisfactory:
Spoiler:
Code:
#===============================================================================
# (PEv19.1 surf_fix by TrankerGolD)
# This script overrides:
# - method passable? from Game_Map
# - pbSurf and pbSurfEnd from Overworld_FieldMoves
# This will handle tiles above water for player surfing and other event walking/surfing
# A decorative and surfable tile above water must have terrain_tag 7 (you can do it trough database)
#
# This is NOT a oficial script fix
# You can see edited lines marked
#===============================================================================
class Game_Map
def passable?(x, y, d, self_event = nil)
return false if !valid?(x, y)
bit = (1 << (d / 2 - 1)) & 0x0f
for event in events.values
next if event.tile_id <= 0
next if event == self_event
next if !event.at_coordinate?(x, y)
next if event.through
next if GameData::TerrainTag.try_get(@terrain_tags[event.tile_id]).ignore_passability
passage = @passages[event.tile_id]
return false if passage & bit != 0
return false if passage & 0x0f == 0x0f
return true if @priorities[event.tile_id] == 0
end
return playerPassable?(x, y, d, self_event) if self_event==$game_player
# All other events
newx = x
newy = y
case d
when 1
newx -= 1
newy += 1
when 2
newy += 1
when 3
newx += 1
newy += 1
when 4
newx -= 1
when 6
newx += 1
when 7
newx -= 1
newy -= 1
when 8
newy -= 1
when 9
newx += 1
newy -= 1
end
return false if !valid?(newx, newy)
for i in [2, 1, 0]
tile_id = data[x, y, i]
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
# If already on water, only allow movement to another water tile
if self_event != nil && terrain.can_surf_freely
for j in [2, 1, 0]
facing_tile_id = data[newx, newy, j]
#-----(EDIT)-----
return false if facing_tile_id == nil || facing_tile_id < 0
next if facing_tile_id == 0
facing_terrain = GameData::TerrainTag.try_get($game_map.terrain_tags[facing_tile_id])
return true if facing_terrain.can_surf_freely
return false if @passages[facing_tile_id]!=0
next if @priorities[facing_tile_id]!=0
return false if @priorities[facing_tile_id]==0 && !facing_terrain.ignore_passability
#-----(end EDIT)-----
end
return false
# Can't walk onto ice
elsif terrain.ice
return false
elsif self_event != nil && self_event.x == x && self_event.y == y
# Can't walk onto ledges
for j in [2, 1, 0]
facing_tile_id = data[newx, newy, j]
return false if facing_tile_id == nil
facing_terrain = GameData::TerrainTag.try_get(@terrain_tags[facing_tile_id])
return false if facing_terrain.ledge
break if facing_terrain.id != :None && !facing_terrain.ignore_passability
end
end
# Regular passability checks
if !terrain || !terrain.ignore_passability
passage = @passages[tile_id]
return false if passage & bit != 0 || passage & 0x0f == 0x0f
return true if @priorities[tile_id] == 0
end
end
return true
end
end
def pbSurf
return false if $game_player.pbFacingEvent
return false if $game_player.pbHasDependentEvents?
#-----(EDIT)-----
facing = pbFacingTile(nil,$game_player)
for i in [2, 1, 0]
facing_tile_id = $game_map.data[facing[1], facing[2], i]
break if facing_tile_id == nil || facing_tile_id < 0
next if facing_tile_id == 0
facing_terrain = GameData::TerrainTag.try_get($game_map.terrain_tags[facing_tile_id])
break if facing_terrain.can_surf
# Ignore if faced tile is above water and has no priority
break if $game_map.passages[facing_tile_id]!=0
next if $game_map.priorities[facing_tile_id]!=0
return false if $game_map.priorities[facing_tile_id]==0 && !facing_terrain.ignore_passability
end
#-----(end EDIT)-----
move = :SURF
movefinder = $Trainer.get_pokemon_with_move(move)
if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF,false) || (!$DEBUG && !movefinder)
return false
end
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
speciesname = (movefinder) ? movefinder.name : $Trainer.name
pbMessage(_INTL("{1} used {2}!",speciesname,GameData::Move.get(move).name))
pbCancelVehicles
pbHiddenMoveAnimation(movefinder)
surfbgm = GameData::Metadata.get.surf_BGM
pbCueBGM(surfbgm,0.5) if surfbgm
pbStartSurfing
return true
end
return false
end
def pbEndSurf(_xOffset,_yOffset)
return false if !$PokemonGlobal.surfing
x = $game_player.x
y = $game_player.y
#-----(EDIT)-----
jump = false
facing = pbFacingTile(nil,$game_player)
for i in [2, 1, 0]
facing_tile_id = $game_map.data[facing[1], facing[2], i]
break if facing_tile_id == nil || facing_tile_id < 0
next if facing_tile_id == 0
facing_terrain = GameData::TerrainTag.try_get($game_map.terrain_tags[facing_tile_id])
break if facing_terrain.can_surf
# Ignore if faced tile is above water and has no priority
break if $game_map.passages[facing_tile_id]!=0
next if $game_map.priorities[facing_tile_id]!=0
jump = true if $game_map.priorities[facing_tile_id]==0 && !facing_terrain.ignore_passability
break if jump
end
if $game_map.terrain_tag(x,y).can_surf && jump#!$game_player.pbFacingTerrainTag.can_surf
#-----(end EDIT)-----
$PokemonTemp.surfJump = [x,y]
if pbJumpToward(1,false,true)
$game_map.autoplayAsCue
$game_player.increase_steps
result = $game_player.check_event_trigger_here([1,2])
pbOnStepTaken(result)
end
$PokemonTemp.surfJump = nil
return true
end
return false
end
Last edited: