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

Pet Translator Help - My hero dies for some reason

Like the title says, when I run my code, my hero is killed by an ogre, though the rest runs smoothly. I was hoping someone might be able to give me a hint as to what’s going wrong. Here is my code:

// Your pet should translate commands.
function onHear(event) {
    // The message the pet heard is in event.message
    var message = event.message;
    // If the message is "North":
    if (message == "North") {
        // The pet says "Htron".
        pet.say("Htron");
    }
    // If the message is "South":
    if (message == "South") {
        // The pet says "Htuos".
        pet.say("Htuos");
    }
    // If the message is "East":
    if (message == "East") {
        // The pet says "Tsae".
        pet.say("Tsae");
    }
}
// Assign the event handler.
pet.on("hear", onHear);
while (true) {
    var enemy = hero.findNearestEnemy();
    // Don't attack Brawlers.
    if (enemy && enemy.type != "brawler") {
        hero.attack(enemy);
    }
}

Any hints would be greatly appreciated!

Um, can you take me a picture of your character? and some items as well.

2 Likes

I don’t see any problems with your code, so it is probably your gear/hero. Like @Trai_Leammookda suggested, a picture would give us a better idea what may be holding you up.

A few other suggestions:
Rangers work well on this level if your weapon has decent distance and some power. Or upgrade your armor with a warrior and chase them down, you just have to be able to withstand the throwers attack until you get in attack range with your sword. You could also use invisibility to sneak up on throwers or chain-lightning to attack from a distance.

1 Like