Hi guys, so I am stuck on brewball. I have got the first part right, catching a potion, but I am stuck on getting back to Omarn and I get this t.copy error:
Here is my code:
// Say anything within 10m of Omarn for him to throw a potion.
// Catch the potion by standing near it before it lands.
// DO NOT LET THE POTION LAND ON THE GROUND!
while(true) {
    var potion = hero.findFriendlyMissiles()[0];
    var firetraps = hero.findNearest(hero.findHazards());
    // Remember that a Fire Trap will trigger if you move closer than 3 meters!
    var omarn = hero.findByType("potion-master")[0];
    if(potion) {
        var dest = potion.targetPos;
        // Go get the potion.
        var potion = Vector.subtract(dest, hero.pos);
        potion = Vector.normalize(potion);
        potion = Vector.multiply(potion, 5);
        if (firetraps) {
            if (hero.distanceTo(firetraps) < 3) {
                var trapVector = Vector.subtract(hero.pos, firetraps.pos);
                trapVector = Vector.normalize(trapVector);
                trapVector = Vector.multiply(trapVector, 10);
                potion = Vector.add(trapVector, potion);
            }
        }
        // Warning: isPathClear doesn't work with Hazards!
        var moveToPos = Vector.add(hero.pos, potion);
        hero.move(moveToPos);
    } else {
        if(omarn && hero.distanceTo(omarn) > 10) {
            // Move back to Omarn.
            var home = {"x": 14, "y": 34};
            // Go back to the x.
            var xpos = Vector.subtract(home, hero.pos);
            xpos = Vector.normalize(xpos);
            xpos = Vector.multiply(xpos, 5);
            if (firetraps) {
                if (hero.distanceTo(firetraps) <= 3) {
                    trapVector = Vector.subtract(hero.pos, firetraps.pos);
                    trapVector = Vector.normalize(trapVector);
                    trapVector = Vector.multiply(trapVector, 5);
                    xpos = Vector.add(trapVector, xpos);
                }
            }
            // Warning: isPathClear doesn't work with Hazards!
            moveToPos = Vector.add(hero.pos, xpos);
            hero.move(moveToPos);
        } else {
            hero.say("Hup, hup!");
        }
    }
}
Thanks for any help!


