[Solved] Stuck on The Two Flowers Python

I’m not sure what’s going wrong with this code exactly, there’s a problem with line 12. It says “command’s argument minion should have type unit, but got object: Hector.”

# If the peasant is damaged, the flowers will shrink!

def summonSoldiers():
    if hero.gold >= hero.costOf("soldier"):

# Define the function: commandSoldiers
def commandSoldiers():
    for soldier in hero.findFriends():
        enemy = soldier.findNearestEnemy()
        if enemy:
            hero.command(soldier, "attack", enemy)

# Define the function: pickUpNearestCoin
def pickUpNearestCoin():
    item = hero.findItems()
    nearestCoin = hero.findNearest(item)
    if nearestCoin:
peasant = hero.findByType("peasant")[0]

while True:
    # commandSoldiers()
    # pickUpNearestCoin()

Any help is greatly appreciated!

What type of boss star do you have? Is it number 3?

I’ve got boss star 1

Because if you dont have a boss star 3 then you cant command peasants. If you have a boss star 2 or 1 then put this after you say for soldier in hero.findFriends()
You have to make sure that you are only commanding the soldiers so use this

if soldier.type == "soldier":
     #put the rest of the code here, remember to indent! ;)

and once you have solved this problem pls put Solved in your title

Thanks, that solved it!

No problem! Im happy to help!