[SOLVED] Recruiting Queue(Help)

// Call peasants one after another.

// Neutral units are detected as enemies.
var neutrals = hero.findEnemies();
while (true) {
    if (neutrals.length) {
        // Say the first unit in the neutrals array
        hero.say(neutral);
    } else {
        hero.say("Nobody here");
    }
    // Reassign the neutrals variable using findEnemies()
    var enemies = hero.findEnemies();
    hero.say(enemies[1]);
    hero.say(enemies[2]);
    hero.say(enemies[3]);
    hero.say(enemies[4]);
    hero.say(enemies[5]);
    hero.say(enemies[6]);
    hero.say(enemies[7]);
    hero.say(enemies[8]);
    hero.say(enemies[9]);
    hero.say(enemies[10]);
}

Delete this.

You need to do something after this line to define the variabile neutral as the first element of the neutrals array. Let me know if you need any more assistance, ok?

1 Like

I don’t get it(20 chars).

also, it says CALL PEASENTS ONE AFTER ANOTHER!
dont say hero.say(enemies[1]), find the nearest friend

Try to put after this

This:

var neutral = neutrals[0];
1 Like

Here put

if (neutrals.length > 0)
1 Like

Here put this

Does it work now?

1 Like

Nope, I’m just gonna search the discourse for answers without posting twice

So have you finished the level?