Skip to content

Commit

Permalink
Pathfinding: Increase timeout when activating Surf
Browse files Browse the repository at this point in the history
I've given the pathfinding algorithm 270 extra frames for waypoints that require activating Surf before triggering a pathing timeout for not having moved tiles for a while.

I don't remember how I chose that particular number, but it caused some issues for me on Emerald where the timeout got triggered before the bot was done starting to surf.

I've increased that limit to 300 frames and now it works. Oh well.
  • Loading branch information
hanzi committed Jan 13, 2025
1 parent 9cfe62e commit 3a8366e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/modes/util/walking.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def follow_waypoints(path: Iterable[Waypoint], run: bool = True) -> Generator:
current_position = get_map_data_for_current_position()
last_waypoint = None
for waypoint in path:
print(waypoint)
# For the first waypoint it is possible that the player avatar is not facing the same way as it needs to
# walk. This leads to the first navigation step to actually become two: Turning around, then doing the step.
# When in tall grass, that could lead to an encounter starting mid-step which messes up the battle handling.
Expand All @@ -170,7 +171,7 @@ def follow_waypoints(path: Iterable[Waypoint], run: bool = True) -> Generator:
if waypoint.is_warp:
frames_remaining_until_timeout += extra_timeout_in_frames_for_warps
if waypoint.action is WaypointAction.Surf:
frames_remaining_until_timeout += 270
frames_remaining_until_timeout += 300
elif waypoint.action is WaypointAction.Waterfall:
frames_remaining_until_timeout += 195 + (get_player_location()[0][1] - waypoint.coordinates[1]) * 42

Expand Down

0 comments on commit 3a8366e

Please sign in to comment.