[SOLVED] Kithgard Brawl 2


#1

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

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


#3

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


#4

I think the item.type is “potion”…


#5

Change the item to item.type


#6

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