Alchemic Power Js Possible bug?


#1

Hey guys so something is not right…

not getting 2 fetch item, then getting blowed into pieces…
Any hints?

// 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 ("Fetch" && potion) {
        // Have the pet fetch the potion.
        pet.fetch(potion);
        pet.moveXY(54, 34);
    }
    // Else (for any other messages):
    else {
        // Return the pet to the red mark.
        pet.moveXY(54, 34);
    }  
}

// You don't have to change the code below.
while(true) {
    pet.on("hear", onHear);
    var enemies = hero.findEnemies();
    var enemy = enemies[enemyIndex];
    var enemyIndex = 0;
    while(enemyIndex < enemies.length) {
        if (enemy && enemy.health > 0) {
            if (hero.isReady("cleave") && hero.distanceTo(enemy) < 5) {
                hero.cleave(enemy);
            }
            else if (hero.isReady("bash")) {
                hero.bash(enemy);
            }
            else if (hero.isReady("warcry")) {
                hero.warcry();
            }
            else if (hero.isReady("throw") && hero.distanceTo(enemy) < hero.throwRange) {
                hero.throw(enemy);
            }
            else {
                hero.shield();
            }
        }
        else if (!enemy) {
            hero.moveXY(40, 34);
        }
        enemyIndex++;
    }
}

#2

What hero are you using?


#3

Arryn stonewall,

I have made some changes and for what i saw one of the possibilities is the pet not being fast enough to deliver the potion,
Increasing the life of the hero might solve this,

I changed the language to python and tried a solved solution to check this out:
the code used is the one below


# The event handler for the pet's event "hear".
def waitFetch(event):
    # Find a nearest potion.
    potion = pet.findNearestByType("potion")
    # If the heard message is "Fetch":
    if event.message == 'Fetch':
        # Fetch the potion.
        pet.fetch(potion)
    # Else (for any other messages):
    else:
        # Return the pet to the red mark.
        pet.moveXY(54, 34)

pet.on("hear", waitFetch)

# You don't have to change code below.
while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(37, 34)


#4

even though the hero is unable to survive the mission.
Upon the change of the hero, result remains the same.
Changed to hero Tharin under the same code.
No success so far.


#5

Try using Okar, and get better armor, Okar has many powerful abilities.