CodeCombat - Kithgard Brawl

Why can’t my pet fetch the health potions in Kithgard Brawl?! Help, please!

My code:

# Survive the waves of ogres.
# If you win, the level gets harder, and gives more rewards.
# If you lose, you must wait a day to re-submit.
# Each time you submit gives a new random seed.
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        if hero.isReady("bash"):

def goFetch():
    while True:
        potion = pet.findNearestByType("potion")
        if potion:

Idk ask @Deadpool198

@Deadpool198, can you help me with this?

You didnt run the function.

Thank You! It worked!

Please delete that code. We’re not supposed to give answers or post the working code.

OK. (20 charsssssssssssssssssssssss)

1 Like

potion, when you do the find by type, it returns an array, not an object

Thank you :slightly_smiling_face: (200000)

WHAT?! You’re not supposed to give answers? I thought that was the point of CodeCombat discourse!

No. The point of CodeCombat discourse is to help you learn. If you give answers, noone learns anything. I shoul’ve ust gave you a hint. But hey I’m new, so everyone makes mistakes.


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