[solved]Siege of stonehold (plz help)

I don’t know why it’s not working

while (true) {
    var flag = this.findFlag();
    var enemy = this.findNearestEnemy();
    if (flag) {
        this.pickUpFlag(flag);
    } else {
        hero.shield();
    }
    if (enemy) {
        if (this.distanceTo(enemy) < 50) {
            if (this.isReady("cleave")) {
                this.cleave(enemy);
            } else {
                this.attack(enemy);
            }
        }
    }
}

it is in JavaScript

id recomend going to the wizard to heal but if you have over 1500 health then you dont need to

Screenshot (18)
it also won’t let me attack the boss

you don’t need to attack thokar

That helps a lot I thought you had to defeat him; because of the mission tab
I’ll try that

Try to delete the

      else {
        hero.shield();
    }

And change

    if (flag) {
        this.pickUpFlag(flag);
    } 
    if (enemy) {
        if (this.distanceTo(enemy) < 50) {
            if (this.isReady("cleave")) {
                this.cleave(enemy);
            } else {
                this.attack(enemy);
            }
        }
    }

into

    if (flag) {
        this.pickUpFlag(flag);
    } else if (enemy) {
        if (this.distanceTo(enemy) < 50) {
            if (this.isReady("cleave")) {
                this.cleave(enemy);
            } else {
                this.attack(enemy);
            }
        }
    }

Thank you! (20crcter)
I was so close then this:Screenshot (19)
Sorry if its small

You are welcome! Glad to help!

I was typing new code because i had 4 health left and I somehow managed to win

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.