[SOLVED] Help on level Dangerous Key

Level times out and no code is executed. Any help appreceated

function onHear(event) {
    // The pet can find the paladin and keys.
    var paladinUnit = pet.findNearestByType("paladin");
    var goldKey = pet.findNearestByType("gold-key");
    var silverKey = pet.findNearestByType("silver-key");
    var bronzeKey = pet.findNearestByType("bronze-key");
    // If event.speaker is paladinUnit:
    if (event.speaker == paladinUnit) {
       if (event.message == "Gold") {
           pet.fetch(goldKey);
       } 
       if (event.message == 'Silver') {
           pet.fetch(silverKey);
       }
       if (event.message == 'Bronz') {
           pet.fetch(bronzeKey);
       }
    }       
}

pet.on("hear", onHear);
2 Likes

Hello and welcome to the forum @help! :partying_face:

To format your code properly, please press the </> button
image

after you format press the button and put your code inside, it should look like this:

// This is an example

could you send a link to the level please @help?

1 Like

It should be 'Bronze'. Watch out for spelling errors :grin:

Hi @help can you please post your new and updated code

Dam haha. That worked, thanks for your help!

2 Likes

congrats on completing the level

1 Like