So I'm trying to add a web node to slash the web in the varrock sewers (ik I can do it manually but I wanted to do it through a web node to understand how they work).
The node shows up on the in game web tool (mine is 10948), but Walking.walk seems to not trigger the node's it's execute function. The isValid is called (and returns true), but the execute never triggers.
What ends up happening is it just clicks in the top right of the minimap just ignoring the whole web and getting stuck.
EDIT: OK so removing the surrounding nodes seems to work, where sometimes it will try to slash the web, but often times it just trys to click further on. I wonder if there's a way to tell it to require it to call the execute before passing through this node
EDIT2: SOLVED. I swapped to a EntranceNode which seemed to have the desired affect. I'll have to figure out how the EntranceNode is built if I need to replicate it with a custom solution but this works for now.
Web node:
package org.dreambot.behaviour;
import org.dreambot.api.methods.interactive.GameObjects;
import org.dreambot.api.methods.interactive.Players;
import org.dreambot.api.methods.walking.web.node.AbstractWebNode;
import org.dreambot.api.utilities.Logger;
import org.dreambot.api.utilities.Sleep;
import org.dreambot.api.wrappers.interactive.GameObject;
public class SlashNode extends AbstractWebNode {
public SlashNode(int x, int y, int z) {
super(x, y, z);
Logger.log("Creating slash node.");
}
@Override
public boolean isValid() {
Logger.log("Checking slash node.");
GameObject web = GameObjects.closest(733);
Logger.log("Checking slash node"+ web != null ? "web is not null" : "web is null");
return true;
}
@Override
public boolean execute() {
Logger.log("seeing if we need to slash web");
GameObject web = GameObjects.closest(733);
if (web != null) {
Logger.log("SLASHING");
web.interact("Slash");
Sleep.sleepUntil(() -> Players.getLocal().isMoving(), 1000);
Sleep.sleepUntil(() -> Players.getLocal().isAnimating() || GameObjects.closest(733) == null, 1000);
if (GameObjects.closest(733) != null) {
Logger.log("FAILED");
return false;
}
}
return true;
}
}
Here's how I add it & walk:
package org.dreambot.behaviour.exampleLeafs;
import org.dreambot.Main;
import org.dreambot.api.methods.container.impl.bank.Bank;
import org.dreambot.api.methods.interactive.GameObjects;
import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.walking.impl.Walking;
import org.dreambot.api.methods.walking.pathfinding.impl.web.WebFinder;
import org.dreambot.api.methods.walking.web.node.AbstractWebNode;
import org.dreambot.api.methods.walking.web.node.CustomWebPath;
import org.dreambot.api.utilities.Sleep;
import org.dreambot.behaviour.SlashNode;
import org.dreambot.framework.Leaf;
import java.util.ArrayList;
public class WalkLeaf extends Leaf<Main> {
private static Boolean first_time = true;
Tile web_tile = new Tile(3210, 9898, 0);
@Override
public boolean isValid() {
if (first_time) {
first_time = false;
AbstractWebNode slashNode = new SlashNode(3210, 9898, 0);
CustomWebPath path = new CustomWebPath(true, slashNode);
path.connectToStart(5959);
path.connectToEnd(5947);
WebFinder.getWebFinder().addCustomWebPath(path);
}
return true;
}
@Override
public int onLoop() {
Tile tile = Bank.getClosestBankLocation().getTile();
Walking.walk(tile);
Sleep.sleep(1000);
return 1000;
}
}
Anyone see what I'm doing wrong?