Yakstraction Curiosity


#1

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);
    }
}
}

#2

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


#3

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


#4

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