[SOLVED] Chase them Help


#1
# 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)


#2


Talk about video game and movie theories
#3

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


#4

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


#5

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


#6

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


#7

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


#8

Where should I put the code?


#9

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


#10

Wat do u mean? 200000000000


#11

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


#12

Didn’t work you guys still have a chance.


#13

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


#14

to beat each other. :rofl:


#15

Then say if potion: pet.fetch(potion)


#16

Gtg @Enderlord832 you won. I think.


#17

Yay thank you. Endelord won


#18

Yaaay. GG @Deadpool198


#19

This isn’t a competition .-.


#20

@SuperSmacker

Or is it…?

DUN DUN DUN!!!
:hushed: