Hunting party, I am hunting for answers!

This is my code so far

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.
        if friend.findNearestEnemy:
            hero.command(friend, "attack", enemy)
        # Command to move east by small steps.
        

I have no idea how to

Command to move east by small steps.

I have barely written any code, 'cause I am so confused!

Don’t summon me. You’ve passed me up by a tiny bit. I can no longer help you. Lol

enpointe77, Did you solve cloudrip commander?

I didn’t summon you, did I?

Nope. I’ve been doing school this entire day. Haven’t had a chance too. But that’s off topic.

No. But you summoned me on cloudrip commander, and I wasn’t quite there yet.

Ok but I helped you in RE: I post to many topics, Weakest quickest help.

Yes. And I’ve been doing school. We’re still off topic. So let’s stop talking about this please.

@hellodaddy what do you need help with? It seems that you arnt fully understanding arrays. Am i correct?

Yah. I always have a little bit of trouble on arrays.

You have to check if there is an enemy using friend.findNearestEnemy(). If that enemy exists, then command your friends to attack that enemy, else command them to move friend.pos.x + 1, friend.pos.y

1 Like

Oh, thanks. abc. I will try that.

Yes abc is correct, i reccomend assigning a variable to friend.findNearestEnemy.

It says that friend.findNearestEnemy() isn’t a thing?

You have to remember to include parenthesis at the end.

haha, I just did that. It still dosn’t work though.

If it gives you an error, then you probably haven’t checked if a friend exists. If a friend exists, then they need to find the nearest enemy to them. If that enemy exists, they need to attack it, otherwise they need to move to the right.

1 Like

Oh, I didn’t check if friend exists. I will do that.

It still doesn’t work,

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