I’m using this code so far.
flag = hero.findFlag()
enemy = hero.findNearestEnemy()
distance = hero.distanceTo(enemy)
ready = hero.cleave(enemy)
if flag: # Pick up the flag. hero.distanceTo(flag) hero.say(flag.pos) hero.moveXY(flag.pos.x, flag.pos.y) hero.pickUpFlag(flag) elif enemy and distance < 10: # Only attack if the enemy distance is < 10 meters hero.attack(enemy) else: hero.moveXY(flag.pos.x, flag.pos.y)
i’m rather new to this whole code stuff but i like it a lot. As far as i can see it gives me the position of the flags im placing, it moves there and picks it up, and also attacks enemy (that i know the distance of) that are within a 10 block radius. But still when i press play and place a flag the guy just runs towards the bombs.
What am i doing wrong?