[Adventurer] Arrowproof Wolf


#15

Ok

Code
# Collect mushrooms.
# First, come to the wolf pet and wake up it (say).
hero.moveXY(pet.pos.x, pet.pos.y)
pet.say("Hi little wolf")
# Next collect mushrooms just usual items.
loop:
    pet.moveXY(hero.pos.x, hero.pos.y)
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)

I put pet.moveXY(hero.pos.x, hero.pos.y) because my pet won’t follow me.


#16

she can’t wake up herself :slight_smile: maybe try

hero.say("Hi little wolf")

oh, and about the pet.moveXY(), once you give commands to your pet it will stop its default behavior of catching arrows or whatever and do what you told it to do (move to a spot)


#17

Better to use pet.on(‘hear’, onHear)

And in the onHear function write pets actions


#18

I’ve added some fixes. I hope it will help.


#19

It was working perfect before for me, still seems good.


#20

Thank guy. Sorry I haven’t been on Codecombat Discourse for a long time.


#21

Chase only works for cougar pet.


#22

Played this level pretty good!


#23

First, come to the wolf pet and wake up it (say).

it’s mean use hero.say(" “) Not mean pet.say(”")

aha…i’m chinese


#24

i’ve got some troubles in python my hero keeps dying … can anyone help :

First, come to the wolf pet and wake up it (say).

hero.moveXY(12,34)
hero.say(“Hello wolfie!”)

Next collect mushrooms just usual items.

while True:
arrow = pet.findNearestByType(“arrow”)
if arrow:
pet.moveXY(hero.pos.x, hero.pos.y)
pet.catch(arrow)
item = hero.findNearestItem()
if item:
hero.move(item.pos)


#25

Well, you have to let us help you. Format your code correctly please.

press the </> thing on the toolbar.
type or paste code here will now look like:

type or paste code here

#26
hero.moveXY(12,34)
hero.say("Hello wolfie!")
# Next collect mushrooms just usual items.
while True:
    arrow = pet.findNearestByType("arrow")
    if arrow:
        pet.moveXY(hero.pos.x, hero.pos.y)
        pet.catch(arrow)
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)


#27

You don’t need to tell your pet to catch arrows your pet automatically catches arrows when it’s near you. The rest of your code is right.


#28

i’ve tried it withouth any code for the pet except the waking up que … but still


#29

i’ve tried it like this:`
and my hero still dies …

# First, come to the wolf pet and wake up it (say).
hero.moveXY(12,34)
hero.say("Hello wolfie!")
# Next collect mushrooms just usual items.
while True:
    item = hero.findNearestItem()
    if item:
        hero.move(item.pos)
`

#30

Your code’s right it’s something to do with your equipment, send a screenshot of your inventory. You might not have the Move boots on or you might not have enough health to survive. :thinking:


#31

yup it was the boots :blush: … heh … thank you kindly sir


#32

My pleasure :grin: (20 chars)


#33

Mod edit:[Please don’t post successful solutions.]


#35

I enjoyed this level. It was fun.