Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Zero Sum: Raise dead will cause errors on enemies = findEnemies()


raising deads on zero sum with commands like

hero.command(friend, "attack", friend.findNearest(enemies))

will result in errors saying

command's argument minion should have type unit, but got object: Acoldan. Hero Placeholder 1 (team ogres) can't command Acoldan (team humans)

removing the raise dead functions will make the codes run perfectly. This errors only shows when a raise dead was accomplished beforehand (as far as i know). The Acoldan is always different with every run, its most likely the name of the enemy units.

Here’s my code snip

while True:
    enemies = hero.findEnemies()
    nearestEnemy = hero.findNearest(enemies)    
    enemyHero = hero.findNearest(hero.findByType("sorcerer",enemies))
    friends = hero.findFriends()
    # In case theres a python error from codecombat
    while True:
        if nearestEnemy:
            if hero.distanceTo(nearestEnemy) < 20 and hero.isReady("mana-blast"):
            elif len(hero.findByType("griffin-rider")) < 3:
                if summon("griffin-rider") == False:
    if len(hero.findByType("artillery")) < 1:

    for friend in friends:
        cage = hero.findByType("cage")
        # Please don't mess with the cage
        if cage:
        nearest_to_friends = friend.findNearest(enemies)
        hero.command(friend, "attack", nearest_to_friends)
    # Raise Dead Corpses
    if hero.isReady("raise-dead"):
        corpses = hero.findCorpses()
        if len(corpses) >= 1:
            undead_army = []
            for corpse in corpses:
                if hero.distanceTo(corpse) < 20:
                if len(undead_army) >= 5:

  1. Try to just take one blocking action each iteration during the loop (moving, casting a spell, attacking etc.), after you command your troops. You don’t want to be trying to command a stale friend variable that used to be on your team but is now on the enemy team because in between when you got the reference and tried to command it, it died and was brought back as an enemy.

  2. Check the types of your friends and don’t command ones that you shouldn’t be able to command.

Hope this helps!