Hi,
Why won’t my guy go get the health potion?
while (true) {
var enemy = hero.findNearestEnemy();
var distance = hero.distanceTo(enemy);
var item = hero.findNearestItem();
if (item == "potion") {
hero.moveXY(item.pos.x, item.pos.y);
} else {
if (enemy && distance < 30 && hero.isReady("bash")) {
hero.bash(enemy);
} else if (enemy && hero.isReady("cleave") && distance < 10) {
hero.cleave(enemy);
} else if (enemy) {
hero.attack(enemy);
}
}
}
Thank you in advance