[Solved] Mixed Unit Tactics Help Me!

I am really stuck here i can someone help me?

here is my code

# Practice using modulo to loop over an array

# Choose the mix and order of units you want to summon by populating this array:
summonTypes = ["griffin-rider", "archer"]
def summonTroops():
    # Use % to wrap around the summonTypes array based on len(hero.built)
    #type = summonTypes[???]
    len(hero.built) % len(summonTypes)
def commandTroops():
    enemy = hero.findNearestEnemy()
    friends = hero.findFriends()
    hero.command(friends, "attack", enemy)
def collectCoins():
    item = hero.findNearestItem()
    hero.move(item.pos)
while True:
    summonTroops()
    commandTroops()
    collectCoins()

and this is the error
and what happens

can you post the link to the level

sure i will try but why do you want it?

i can’t find the level

i finished it though as i am on the glacier

okay found it(20chars)

i see ur profile picture very cool too many gems for me too afford though

sorry can’t help you for this though i did it in java

don’t worry after you start on glacier you will definitely get my outfit

lololol that doesn’t help me

I found a way to get more gems doing brawls

yeah well my equipment though doesn’t get me far on brawls :expressionless:

nice(20annoyingchars)

okay i found a way in python

do you still need help

yes i do i am still stuck but how can you help me if you are using java?

In your commandTroops() function you command friend to do smth. But what if all the friends are dead? So, in def function check if there is a friend or write smth like “for friend in friends”.

1 Like

it is fine i solved it but thx anyway

2 Likes