Recruiting Queue

# Call peasants one after another.

# Neutral units are detected as enemies.
neutrals = hero.findEnemies()
while True:
    if len(neutrals):
        # Say the first unit in the neutrals array
        hero.say(unit[1])
        pass
    else:
        hero.say("Nobody here")
    
    # Reassign the neutrals variable using findEnemies()
    enemies = hero.findEnemies()

` This is my code but it keeps on saying nobody’s here

@isnode either check for neutrals or check for enemies, but not both. Right now you are updating enemies but checking neutrals. Those are 2 separate variables.

In the beginning of the level often there are no enemies, so neutrals would be empty. And since you are not updating it at all, then it will always have a array length of 0.

I don’t understand how to use the coding could you tell me exactly what to change what to?

Change the code to include this additional hero.say() and it should become more apparent.

# Neutral units are detected as enemies.
neutrals = hero.findEnemies()
while True:
    if enemies:
        hero.say("neutrals length is: " + neutrals.length + 
        " | enemies length is: " + enemies.length )

    if len(neutrals):
        # Say the first unit in the neutrals array
        hero.say(unit[1])
        pass
    else:
        hero.say("Nobody here")
    
    # Reassign the neutrals variable using findEnemies()
    enemies = hero.findEnemies()

no, it doesn’t work but this does except I shout the second person’s name first

# Call peasants one after another.

# Neutral units are detected as enemies.
enemies = hero.findEnemies()
while True:
    if len(enemies):
        # Say the first unit in the neutrals array
        hero.say(enemies[1])
        pass
    else:
        hero.say("Nobody here")
    
    # Reassign the neutrals variable using findEnemies()
    enemies = hero.findEnemies()

oh I worked it out

[please, don’t post solutions]

...
        hero.say(enemies[0])
...