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

Alchemic Power(Issue) Need Help

There might be something wrong with this level. My bird is acting stupid. It fly’s out for no reason, then when it time to fetch, the stupid thing brings it half way then fly’s back.
Here is my code–

def onHear(event):
# Find the nearest potion.
potion = pet.findNearestByType(“potion”)
message = event.message
# If the event’s message is “Fetch”
if message is “Fetch”:
# Have the pet fetch the potion.
pet.fetch(potion)
# Else (for any other messages):
else:
# Use pet.moveXY to return the pet to the red mark.
pet.moveXY(53,34)

pet.on(“hear”, onHear)

You don’t have to change the code below.

while True:
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34)

@Mr.Wezi, please format your code properly. Here’s how to do it: [Essentials] How To Post/Format Your Code Correctly

ok
</>def onHear(event):
# Find the nearest potion.
potion = pet.findNearestByType(“potion”)
message = event.message
# If the event’s message is “Fetch”
if message is “Fetch”:
# Have the pet fetch the potion.
pet.fetch(potion)
# Else (for any other messages):
else:
# Use pet.moveXY to return the pet to the red mark.
pet.moveXY(53,34)

pet.on(“hear”, onHear)

You don’t have to change the code below.

while True:
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34) </>

hold on that didnt work

def onHear(event):
    # Find the nearest potion.
    potion = pet.findNearestByType("potion")
    message = event.message
    # If the event's message is "Fetch"
    if message is "Fetch":
        # Have the pet fetch the potion.
        pet.fetch(potion)
    # Else (for any other messages):
    else:
        # Use pet.moveXY to return the pet to the red mark.
        pet.moveXY(53,34)

pet.on("hear", onHear)

# You don't have to change the code below.
while True:
    enemy = hero.findNearest(hero.findEnemies())
    if enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(40, 34)

Much better…thank you!

There is no difference between your code and mine, so, that leaves equipment. I’m using the wolf cub for this level…have you tried him yet?

and, I just tried with the bird and it succeeded too.

No I havent tried the cub. will try. But i find it strange that you say our codes match and that the bird works fine for you,but not for me.

Nope Still not working properly. The pup runs out farther then the bird flew but runs back without giving me the potion.

Ok, how about browser? I’m using Chrome, but have not tried in any other. If not, then we’ll need the big guns to check this out…@Chaboi_3000, likely.

Yeah i using Chrome also, but still not working. Ok i’ll let Chaboi have a look. Thanks for your help though.