Hunting Party/ Python/ Error message [Solved]

I don’t know what the following error message even means so…
Error
And my code of course

# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
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.
        else:
            hero.command(friend, "move", {'x' friend.pos.x + 1, 'x' friend.pos.y})

You wrote x 2 times and instead of hero.command(friend, "move", {'x' friend.pos.x + 1, 'x' friend.pos.y}) try doing

` hero.command(friend, "move", {'x' friend.pos.x + 5, 'y' friend.pos.y})`

[quote=“Some_Guy, post:1, topic:27951”]
hero.command(friend, "move", {'x' friend.pos.x + 1, 'x' friend.pos.y})
[/quote]--------

@milton.jinich like this?

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.
        else:
            hero.command(friend, "move", {'x' friend.pos.x + 1, 'y' friend.pos.y})

The problem is not that (as far as I can see).
It seems to me your structure of the move command is wrong.
You’ve done

It should have : after the ‘x’ and the ‘y’ for:
{'x': friend.pos.x + 1, 'y': friend.pos.y}
This is just a simple syntax error I think.
Danny

Oh thanks for picking that up. So I think you just forgot these : at the end of 'y' and 'x.

Thank you yeah i just forgot the :

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