[Help] Alchemic Power


#1

I am stuck on this level. When Omarn says “Fetch!”, it is AFTER I die. When she does say “Fetch!” BEFORE I die however, the pet carries the potion to my hero, but never delivers it and turns around instead.

Code:

// Wait for alchemist’s commands to fetch potions.

// The event handler for the pet’s event “hear”.
function onHear(event) {
// Find the nearest potion.
var potion = pet.findNearestByType(“potion”);
// If the event’s message is "Fetch"
if (event.message == “Fetch”) {
pet.fetch(potion);
}else{
pet.moveXY(54, 34);
}
// Have the pet fetch the potion.

// Else (for any other messages):

    // Return the pet to the red mark.

}

pet.on(“hear”, onHear);

// You don’t have to change the code below.
while(true) {
var enemy = hero.findNearest(hero.findEnemies());
if (enemy) {
hero.attack(enemy);
}
else {
hero.moveXY(40, 34);
}
}


#2

Please format your code according to the FAQ.

What gear does your hero have? Maybe that’s why your hero dies before Omarn says “Fetch”.


#3

I have the best armor in the game. I have the Deflector, Dragon Head, and Dragon Chestplate


#4

}else{ ?

[20 characters minimum]


#5

Could you please post your code so I could compare mine with yours and see if yours works? I know it may sound a little greedy but I can’t think of any thing else I could do.


#6

This is interesting. I don’t see anything wrong. I have similar code and it runs perfectly.

Maybe bug in the level? Or try clearing cache? Don’t know if it will help, but just maybe…


#7

Hi!

I had the same problem. But when I reset the level, it works perfectly.


#8

That’s what I did! Thanks.