Trying to upgrade my fighting script with looting capabilities, but for some reason, adding the loot task has made my bot now freeze where I cannot even move the window or click anything, and eventually crashes the bot. Something is obviously wrong with my code
here is my task list
if(userChoices.equals("Fire giant")) {
//tasks.add(new Idle(this));
tasks.add(new Eat(this));
tasks.add(new FightFiregiant(this));
tasks.add(new Loot(this));
}
And here is my loot task code
public class Loot extends Task {
public int GroundID[] = {
10006, 303, 954, 11940, 560, 563, 565, 890, 561, 207, 5295, 5300, 5304, 5315, 211, 213, 217, 215, 2485,
1079, 1113, 1127, 1147, 1163, 1185, 1201, 1213, 1247, 1275, 1289, 1333, 1347, 1359, 1373, 4131, 3122, 1393, 1395, 1397, 1399,
892, 562, 1147, 985, 987, 2366, 2368, 22347, 4151, 1249, 13265, 1149, 1319,
4153, 4154, 4101, 445, 2357, 2354, 2359,
451, 2358, 444, 2356, 2360, 1073
};
public Loot(Fighter script) {
super(script);
}
@Override
public boolean canProcess() throws InterruptedException {
return script.getGroundItems().closest(GroundID) != null && script.getGroundItems().closest(GroundID).isOnScreen();
//script.getGroundItems().closest(GroundID).isVisible() ;
}
@Override
public void process() throws InterruptedException {
script.currentState = Status.LOOTING;
GroundItem loot = script.getGroundItems().closest(GroundID);
//if (GroundID != null && !script.getInventory().isFull())
if (!script.inventory.isFull()){
loot.interact("Take");
sleep(random(999,1777));
}
}
}
And help would be appreciated! THANKS!