Stuck on Zoo Keeper


#1

I’m stuck on Zoo Keeper. Apparently, my problem is that it cannot read ‘start’ of undefined. I don’t really understand. Here is my code:

for j in range(len(friends)):
point = points[j]
friend = friends[j]
enemy = friend.findNearestEnemy()
if friend and enemy and enemy.team == “ogres” and fr.distanceTo(enemy) < 5:
hero.command(friend, “attack”, enemy)
elif friend:
hero.command(friend, “move”, point

3. Send your soldiers into position.

while True:
friends = hero.findFriends()
for j in range(len(friends)):
point = points[j]
friend = friends[j]
enemy = friend.findNearestEnemy()
if enemy and enemy.team == “ogres” and friend.distanceTo(enemy) < 5:
# Command friend to attack.
pass
hero.command(friend, “attack”, enemy)
else:
# Command friend to move to point.
pass
hero.command(friend, “move”, 47, 42)


#2

What is points? Did you define that? :wink:
Never heard of fr.distanceTo(enemy). Try using friend.
Also, try getting your friend to move to point in the loop rather than a fixed (x, y) coordinate. :slight_smile:


#3

Ah. Thanks for helping me! Will go to check now.