This is my code:
points = []
points[0] = {"x": 33, "y": 42}
points[1] = {"x": 47, "y": 42}
points[2] = {"x": 33, "y": 26}
points[3] = {"x": 47, "y": 26}
while hero.gold < 80:
item = hero.findNearestItem()
hero.move(item.pos)
for i in range(4):
hero.summon("soldier")
while True:
friends = hero.findFriends()
for j in range(len(friends)):
point = points[j]
friend = friends[j]
enemy = friend.findNearestEnemy()
if enemy and enemy.team == "ogres" and friend.distanceTo(enemy) < 5:
hero.command(friend, "attack", enemy)
pass
elif friend:
hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})
pass
it says point.pos.x is undefined, right here:
elif friend:
hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})
even though it is defined, here:
for j in range(len(friends)):
point = points[j]
and i have tried defining it again and also using point.pos (which says target an x : number y : number position). nothing works even though it should.
elif friend:
point = points[j]
hero.command(friend, "move", {"x" : point.pos.x, "y" : point.pos.y})
elif friend:
hero.command(friend, "move", point.pos)