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

Dangerous key help

#1
# Listen to the paladin and fetch the right key.

def onHear(event):
    # The pet can find the paladin and keys.
    paladinUnit = pet.findNearestByType("paladin")
    goldKey = pet.findNearestByType("gold-key")
    silverKey = pet.findNearestByType("silver-key")
    bronzeKey = pet.findNearestByType("bronze-key")
    # If event.speaker is paladinUnit:
    if event.speaker == paladinUnit:
        # If event.message is "Gold":
        if event.message == "Gold":
            # The pet should fetch the gold key.
            pet.fetch("gold-key")
        # If event.message is "Silver":
        if event.message == "Silver":
            # The pet should fetch the silver key.
            pet.fetch("silver-key")
        # If event.message is "Bronze":
        if event.message == "Bronze":
            # The pet should fetch the bronze key.
            pet.fetch("bronze-key")

pet.on("hear", onHear)

#2

39%20AM

#3

Use a pet that is on the ground

#4

why?
20 characterssssss

#5

I don’t know just use one on the ground then it should work. Your code is fine

#6

No it doesn’t work.
20 chars

#7

@Archion :disappointed_relieved:

#8

I don’t know then. it should work :thinking:

#9

What pet did you use @Archion

#10

Where is the level? can you post a link

#11

Ok https://codecombat.com/play/level/dangerous-key?

#12

I used a griffin baby pet

#13

Ok
2000000 characters

#14

Did you win? :face_with_raised_eyebrow:

#15

Yea 20000000000000000 chars

#16

Could you help me
20000000 character

#17

#18

maybe this is a bug for you. You should report it

#19

oh no a bug!:open_mouth:

#20

this is a #bugs 200000000000000000 chars