Using the following code, I’m getting an “Unhandled error: distance’s argument target has a problem. Find the distance to a target unit.” a little ways in.
ball = hero.findNearest(hero.findByType("ball"))
peasants = hero.findByType("peasant")
while True:
if ball.pos.x < 26:
while ball.pos.x < 26:
hero.command(peasants[0], "move", {"x": 19, "y": ball.pos.y+1})
hero.command(peasants[1], "move", {"x": 19, "y": ball.pos.y-1})
hero.wait(.1)
else:
hero.command(peasants[0], "move", {"x": 19, "y": 40})
hero.command(peasants[1], "move", {"x": 19, "y": 32})
As you can see, I’m not even using distanceTo in my code! Any ideas why this error might be happening?
Screenshot -