# Gather coins to summon soldiers and have them attack the enemy.
while True:
hero.findNearestItem()
coin = NearestItem
# Move to the nearest coin.
# Use move instead of moveXY so you can command constantly.
if coin:
hero.move(coin.pos.x) (coin.pos.y)
hero.say("I need coins!")
# If you have funds for a soldier, summon one.
if hero.gold > hero.costOf("soldier"):
hero.say("I should summon something here!")
hero.summon("soldier")
enemy = hero.findNearest(hero.findEnemies())
if enemy:
soldiers = hero.findFriends()
soldierIndex = 0
soldier = soldiers[soldierIndex]
# Loop over all your soldiers and order them to attack.
while True:
# Use the 'attack' command to make your soldiers attack
hero.command(soldier, "attack", enemy)
#hero.command(soldier, "attack", enemy)
So using this Python code gives me
but if I remove line 4 it gives me
and i’m really confused on what to do to fix it.
while True:
coin = hero.findNearestItem()
# Move to the nearest coin.
# Use move instead of moveXY so you can command constantly.
if coin:
hero.move(coin.pos.x) (coin.pos.y)
Apparantly there’s something wrong on the last line
This statement takes only one parameter, and i doubt that there is any method that takes more than one pair of parenthesis.
You can either do: hero.move(coin.pos)
or hero.moveXY(coin.posx, coin.pos.y)