Hello I am a but confused with this level. My character will not respond to any code I put in front of him.
As you can see in this screenshot I tried using flags to get him to respond but it still wont work…
You can just pickUpFlag(flag) instead of having to move to it. Using this method, your hero automatically moves to it and picks it up. No move statement required
Also define flag in the loop.
Need help with Siege of Stonehold
Here is my code:
var flagG = hero.findFlag("green");
var flagB = hero.findFlag("black");
var flag = hero.findFlag("green" || "black);
function pickUp(flag) {
var item = hero.findNearestItem();
var position = item.pos;
var x = position.x;
var y = position.y;
var flagV = hero.findFlag(flagG);
var flagB = hero.findFlag(FalgB);
if (flagG) {
hero.moveXY(x, y);
hero.pickUpFlag(flagG);
}
if (flagB) {
hero.moveXY(x, y);
hero.pickUpFlag(flagB);
}
}
var enemy = hero.findNearestEnemy();
while (true) {
pickUp(flag);
if (flagG)
pickUp(flag);
if (enemy) {
hero.attack(enemy);
}
if (flagB) {
pickUp(flag);
var ready = hero.isReady("cleave");
if (enemy) {
if (ready) {
hero.cleave(enemy);
}
}
}
}