Hunting Party (Bonus)/ Python/ Help

My code is doing fine except for one archer who dies and i don’t know how to save him

while True:
    friends = hero.findFriends()
    # Use for-loop and for each friend:
    for friend in friends:
        # If they see an enemy then command to attack.
        enemy = friend.findNearestEnemy()
        if enemy:
            hero.command(friend, "attack", enemy)
        # Command to move east by small steps.
        elif < 30:
            hero.command(friend, "move", {'x': friend.pos.x - 5, 'y': friend.pos.y})
            hero.command(friend, "move", {'x': friend.pos.x + 1, 'y': friend.pos.y})

Try adding this

if friend.type is "soldier":
                hero.command(friend, "move", {"x":friend.pos.x+5,"y":friend.pos.y})
                hero.command(friend, "move", {"x":friend.pos.x+1,"y":friend.pos.y})

instead of this

If it doesn’t work try submitting a few times.

I tried that but they move at the same speed still

Try submitting again and again

Ok i got it eventually : /

Congrats! Please mark the post that helped you solve your problem.

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