Hey, kinda new to this bot but thought I could give scripting a try.
Started with a chicken killer and it works pretty good, some minor tweaks for attacking and finding "free" chickens is still needed tho.
My biggest issue is that it doesn't loot at all and also clicks the chicken while attacking, can also click another chicken even if the first one isnt dead yet, been searching a few threads for some answers and stuff I could try to fix it but with no success.
My code so far.
private enum State {
PICK_UP, KILL, WAIT
};
private State getState() {
GroundItem feathers = groundItems.closest("Feathers");
if ((feathers !=null && !myPlayer().isUnderAttack()))
return State.PICK_UP;
if (!inventory.isFull())
return State.KILL;
return State.WAIT;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case PICK_UP:
GroundItem feathers = groundItems.closest("Feathers");
if ((!inventory.isFull() && !myPlayer().isUnderAttack())) {
feathers.interact("Take");
wait(100,300);
}
break;
case KILL:
Player player = myPlayer();
NPC chicken = npcs.closest("Chicken");
if((!player.isMoving()) && (!player.isUnderAttack()) && (chicken.isAttackable()) && (chicken.isVisible()) && (chicken.getHealth()>0) && (chicken.getName().contains("Chicken")) && (chicken != null)) {
chicken.interact("Attack");
sleep(random(200, 350));
} else {
camera.toEntity(chicken);
}
break;
case WAIT:
sleep(random(500, 700));
break;
}
return random(200,300); //The amount of time in milliseconds before the loop starts over
}
What I'm trying to do is a chicken killer which loots feathers from only those I kill. That's my first goal, will be going for bury bones and such when I get this to work.
So please tell me if you see something that's need to be changed/removed/added.
Zoubiey