Siege of stonehold [HELP]

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…


I have even tried stuff as simple as hero.move(x, y);

it should be

loop {

You must first assign hero.findFlag to a variable. Perhaps write something like:

var flag = [insert findflag function]
if(hero.findFlag){
   [insert moveXY to flog]
   hero.pickUpflag( [insert variable's name]);
}

As for the rest of the level, it will take much more than moving to flags.

You must also do

loop {
    var flag = hero.find flag()
    if flag {
            hero.pickUpFlag(flag)

You should also attack enemies

@CHECHA1232 *findFlag, not find flag.

Oops, My computer messed up

I am not great at javascript. Im more of a python coder:slight_smile:

Still will not work. @_TD_RodYT @CHECHA1232

I am only seeing why my character will not move. I am not trying to complete the whole level at the moment.

Nooo. Listen carefully.

hero.findFlag is a FUNCTION. It means nothing.

You should use if (flag) instead because flag has already been assigned to a value when you called the findFlag function.

You also must indent correctly

OH stupid me, Thanks.

Indent proper areas.

I’m having a similar issue. I assigned a variable for flags:

flag = hero.findFlag()

Then used a loop for moving and picking it up:

while True:
    if flag:
        hero.moveXY(flag.pos.x, flag.pos.y)
        hero.pickUpFlag(flag)

But for some reason my hero will not move to the flag. Any thoughts?

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 :wink:
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);
            }
        }
    }
}

[en_US.composer.my_buttons_text]