# If the peasant is damaged, the flowers will shrink!
def summonSoldiers():
if hero.gold >= hero.costOf("soldier"):
hero.summon("soldier")
# Define the function: commandSoldiers
def commandSoldiers ():
hero.command(Soldiers, "attack", target)
# Define the function: pickUpNearestCoin
def pickUpNearestCoin ():
peasant = hero.findByType("peasant")[0]
while True:
summonSoldiers()
# commandSoldiers()
# pickUpNearestCoin()
hero.findNearesItem()
1 Like
never mind
just a typo
But I still need help.
Well, there’s a lot missing. Your commandSoldiers function needs to have a lot more code defining enemy and soldiers and use a loop. Your pickUpNearestCoin function contains zero code regarding finding and moving to a coin’s position to pick it up. Your while True loop doesn’t contain enough code either. You need to call all 3 of your functions there.
1 Like
Thanks!
(20 chars)