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
friends.remove(hero.findByType("cage"))
friends.remove(hero.findByType("yeti"))
while True:
if nearestEnemy:
if hero.distanceTo(nearestEnemy) < 20 and hero.isReady("mana-blast"):
hero.manaBlast()
summon("soldier",5)
elif len(hero.findByType("griffin-rider")) < 3:
if summon("griffin-rider") == False:
break
else:
break
else:
break
if len(hero.findByType("artillery")) < 1:
summon("artillery")
for friend in friends:
cage = hero.findByType("cage")
# Please don't mess with the cage
if cage:
enemies.remove(cage[0])
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:
undead_army.append(corpse)
if len(undead_army) >= 5:
hero.cast("raise-dead")
break