[SOLVED] Kithgard Brawl 2

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

2 Likes

i’m not good with javascript but if @Hellenar is around . . .

Thanks, anyway; keep simulating ALL THE GAMES :slight_smile:

I think the item.type is “potion”…

Change the item to item.type

@xython @chaboi_3000 thanks dudes!! that was the ticket. I was so close lol