diff --git a/CAgility/src/io/reisub/dreambot/cagility/tasks/HandleObstacle.java b/CAgility/src/io/reisub/dreambot/cagility/tasks/HandleObstacle.java index 90e7cae..c3b1a9f 100644 --- a/CAgility/src/io/reisub/dreambot/cagility/tasks/HandleObstacle.java +++ b/CAgility/src/io/reisub/dreambot/cagility/tasks/HandleObstacle.java @@ -97,6 +97,8 @@ public class HandleObstacle extends TaskNode { private final Course course; private final Map hoverMap; + private int retries = 0; + public HandleObstacle(Course course) { this.course = course; this.hoverMap = new HashMap<>(); @@ -113,16 +115,22 @@ public class HandleObstacle extends TaskNode { public int execute() { Obstacle current = course.getCurrentObstacle(); if (current == null) { - MethodContext.logError("Player is in an unsupported area: " + Players.localPlayer().getTile().toString() + ". Stopping."); - ScriptManager.getScriptManager().stop(); - return 0; + if (retries >= 10) { + MethodContext.logError("Player is in an unsupported area: " + Players.localPlayer().getTile().toString() + ". Stopping."); + ScriptManager.getScriptManager().stop(); + } else { + retries++; + } + + return Calculations.random(300, 400); } + retries = 0; final GameObject currentObject = current.getGameObject(); if (currentObject == null) return Calculations.random(300, 500); if (!currentObject.isOnScreen()) { - Walking.clickTileOnMinimap(currentObject.getTile()); + Walking.walk(currentObject); MethodContext.sleepUntil(() -> Players.localPlayer().distance(currentObject) < 3, Calculations.random(5000, 5500)); }