Yakstraction Curiosity

Hi,

It’s all working but the yaks don’t seem interested in my decoys…

Anyone…anyone…(Bueller?)…?

while(true) {
    var greenflag = hero.findFlag("green");
    var blackflag = hero.findFlag("black");
    if (blackflag && (hero.gold >= 25)) {
        hero.buildXY("decoy", blackflag.pos.x, blackflag.pos.y);
        hero.pickUpFlag(blackflag);
    } else {
var coin = hero.findNearestItem();
    if (coin) {
        hero.moveXY(coin.pos.x, coin.pos.y);
    }
}
}

Maybe the decoys don’t get close enough to yaks or a bug in your code stops it from running completely?

I don’t believe so because the code runs correctly…coins collected, blackflag plants decoy…but the yaks ignore it

yaks don’t attack anything unless something attacks it first. so then the yaks would completely ignore you until you attack it.