[SOLVED] Chase them Help

# Defeat the ogres and cure the hero.

# The pet is your only hope.
def onSpawn(e):
    while True:
        enemy = pet.findNearestByType("munchkin")
        if enemy and pet.isReady("chase"):
            pet.chase(enemy)
        # Find and fetch a "potion":
        item = hero.findNearestItem()
        if item.type == "potion":
            pet.fetch(item)

# Assign "onSpawn" handler on the "spawn" event
pet.on("spawn", onSpawn)

You gotta use the pet to find the item in your onSpawn function because the hero is disabled.

Your pet should find the item. You need to make your pet.findbytype(potion) @Gamestack

That was so close, this is so funny why r we racing to help someone!

Im not sure but i am striving to be a helpful user

Same, but I’m not exactly sure how, cuz it’s not a badge.

Where should I put the code?

Before you say if item.type == “potion”

Wat do u mean? 200000000000

Ha! I did it before you @Deadpool198 :smile:

Didn’t work you guys still have a chance.

Replace hero.findnearestItem() with ‘potion = pet.findnearestByType(“potion”)’

to beat each other. :rofl:

Then say if potion: pet.fetch(potion)

Gtg @Archion you won. I think.

Yay thank you. Endelord won

Yaaay. GG @Deadpool198

This isn’t a competition .-.

2 Likes

@SuperSmacker

Or is it…?

DUN DUN DUN!!!
:hushed: