So. I’ve read through the other posts and nobody seems to have the same problem I’m having. On top of lagging, only one soldier ever goes to attack the enemy at once. Code is as follows:
while True:
# Move to the nearest coin.
# Use move instead of moveXY so you can command constantly.
coin = hero.findNearest(hero.findItems())
hero.move(coin.pos)
# If you have funds for a soldier, summon one.
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
if enemy:
# Loop over all your soldiers and order them to attack.
soldiers = hero.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
while soldierIndex < len(soldiers):
hero.command(soldier, "attack", enemy)
# Use the 'attack' command to make your soldiers attack.
soldierIndex += 1
What am I doing wrong here?