Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

I am stuck on zoo keeper the yeti is on the run

my hero keeps getting an error and my soldiers never defend

Send me ur code?

Mumbo_6

What is the error? Also, like @Mumbo_6 said, what is your code? Remember to put 3 backticks before and after your code to format it correctly, like this.

@GraySkayl007 rather post the link to where @cheddarcheese can see how to post it?

Mumbo_6

1 Like

Ooooooh, I see, @cheddarcheese is from canada (as you can see in PeterPalovs great topi: [Idea] Illia shieldsmith biography #adventurer)
So @cheddarcheese is asleep right now :smile:

Mumbo_6

1 Like

Umm… if he has a bedtime of 10 pm, then probably.
Lydia

1 Like

Yea, but it anyways is almost midnight in canada (from my location (Munich, Germany)) ≈ -8 hours

Mumbo_6

2 Likes

it is not 10 it is 9

I don’t know if he is in Central, Mountain, Pacific, or East time zone. So it is 9-10 pm
Lydia

I’m in Canada just saying…

1 Like

east its east time zone

1 Like

Ok, can we change this back into a level help topic and not a „Time-zone-arguing“ topic? @cheddarcheese can you send your code (formatted using the </> button)?

Mumbo_6

1 Like
# Protect the cage.
# Put a soldier at each X.
points = []
points[0] = {"x": 33, "y": 42}
points[1] = {"x": 47, "y": 42}
points[2] = {"x": 33, "y": 26}
points[3] = {"x": 47, "y": 26}

# 1. Collect 80 gold.
item = hero.findNearestItem()
while hero.gold < 80:
    hero.move(item.pos)
    item = hero.findNearestItem()
# 2. Build 4 soldiers.
for i in range(4):
    hero.summon("soldier")
    
# 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.
            friend = hero.findFriends()
            hero.command(friend, "attack", enemy)
            pass
            
        else:
            # Command friend to move to point.
            hero.command(friend, "move", {"x": 40, "y": 32})
            pass
            
1 Like

What’s your problem?

Mumbo_6

1 Like

You may need to define enemy = Friend.findNearestEnemy

Mumbo_6

1 Like

Also, what’s This: for i in range And for j in range?

Mumbo_6

1 Like

i dont know the level typed it in itself

it says it dosent know what to command

Could you please ask someone else to help for now? I’m kind of busy in school…

Mumbo_6

1 Like

it says should have typed minion instead got and array