[Adventurer] Sand mushrooms

The new desert level about pets: Sand Mushrooms.

Pets don’t have findNearestItem method, but they have findNearestByType. This level opens the series about this useful method.

Learn your pet to distinguish potions and mushrooms.

1 Like

I have in my Inventory Wolf Pup but in Level is my Pet Baby Griffin …

Yep. Because this level requires a flying pet, but it’s not unlocked as an “item” yet. So you have the griffin pet for “free” on this level.

Played this level just now, and I loved it.
It’s simple enough for me to understand (Not very good at coding, started a few days ago) yet still shows you how to do things.

my raven said: “I can’t carry that!” :frowning_face:

Sorry for necroposting but I am currently stuck on this level. I cannot select play and it wants me to use the crow but I cannot select it because I am not subscribed.

Obvious answer would be to subscribe but with other levels I could always play and get a random pet assigned (as noted above by Bryukh). Am I missing something or is this a bug?

Ok found it, instead of double clicking the raven, you should drag and drop it.

about that raven, it could not carry the potion :rage:

I am on level 33 by the way :sweat_smile:

@Caleb_Soo Maybe something wrong in your code?

@Bryukh here’s my code:

def onSpawn(event):
    while True:
        potion = pet.findNearestByType("potion")
        pet.fetch("potion")

pet.on("spawn", onSpawn)

while True:
    someItem = hero.findNearestItem()
    if someItem and hero.health > hero.maxHealth / 3:
        hero.moveXY(someItem.pos.x, someItem.pos.y)
        pass

I am not so sure anyways :frowning:

Could you post your code? The raven can carry potions as any other pets. They use the same component for that.

@Caleb_Soo have you played levels before that one? Do you know the difference between a variable and a string? Pets need the certain item variable, not its type to fetch

3 Likes

For example, you need to pass an object:

var item = pet.findNearestItem();
pet.fetch(item);
2 Likes

yes I do…:neutral_face:

potion = pet.findNearestByType(“potion”) was default

now i am stuck on the someItem part :confused:

Shouldn’t it be

potion = pet.findNearest(pet.findByType("potion"))
pet.fetch(potion)
1 Like
potion != "potion"

findNearestByType gets a string (type) as an argument. pet.fetch needs an item (object) as an argument. For some commands as attack you can use a string or a unit as an argument, but if you use a string it should be the ID (name) (not type).

1 Like