Grim determination problem object: Taric


Hello, on the level “grim determination” i receive message: "Line 37: command’s argument minion should have type unit, but not object: Taric. Hero Placeholder (team humans) can’t command Taric (team ogres)"
My code:

def commandGriffin(friend):
    enemy = friend.findNearestEnemy()
    if enemy:
        hero.command(friend, "attack", enemy)

def commandPeasant(fr):
    items = fr.findItems()
    item = fr.findNearest(items)
    hero.command(fr, "move", item.pos)

# Найти паладина с самым низким количеством здоровья.
def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = hero.findFriends()
    for friend in friends:
        if friend.type != "paladin":
        if < lowestHealth and < friend.maxHealth:
            lowestHealth =
            lowestFriend = friend
    return lowestFriend

def commandPaladin(paladin):
    # Полечи паладина с низким количеством здоровья используя lowestHealthPaladin()
    needH = lowestHealthPaladin()
    if needH:
        if paladin.canCast("heal"):
            hero.command(paladin, "cast", "heal", needH)
    # Ты можешь использовать paladin.canCast ("heal") и command(paladin, "cast", "heal", target)
    # Паладины также могут использовать щит: command(paladin, "shield")
    hero.command(paladin, "shield")
    enemy = paladin.findNearestEnemy()
    if enemy:
        hero.command(paladin, "attack", enemy)

def commandFriends():
    # Командуй своими союзниками.
    friends = hero.findFriends()
    #pal = 0
    for friend in friends:
        if friend.type == "peasant":
        elif friend.type == "griffin-rider":
        elif friend.type == "paladin":
            #if < 3 or > 15:
            #hero.say(", "
            #pal +=1
    #if < 3 or > 15:   
    #    hero.say("Number of paladins: "+pal)

while True:
    #if > 9 and < 15:
        #enemies = hero.findEnemies()
        #for enemy in enemies:
            #hero.say(enemy.type +", "+ +", "
    if >= hero.costOf("griffin-rider"):

How can i fix it?


First, please, post your code with radiant, harmonious formatting. For python indents are really important and your code isn’t readable in the current format. How to do it you can read here: FAQ - Check Before Posting


Sorry, I tried to put only one `, like it is in editor. Now i put three and it work’s. Thanks


Hm, it looks not bad (non optimal, but not bad). I tried your code and sometimes win, sometimes lose. But I haven’t gotten an error. Could you give some screenshot (with battlefield and who is Taric)?


Here is scrennshoot:

Yes, code isn’t optimal (-:
I noticed, when i use hero.say() - this mistake doesn’t appear


Hm, I need to check one idea.

Could you say your sessionID? (open web dev console and look there) Or say me you CodeCombat nickname (or email in direct message).


CodeCombat nick: Vladimir Sinchevici
If i correctly found id is: window.userObject = {"_id":“57af950856814d2500b75ac5”


Ok. I tried to play under your account but I haven’t get this error.

I suppose that you get an event with low probability. While your command your paladins a warlock resurrect a paladin and she changes the team. Could you check it (you can see it on the battlefield)?

Try to click “Завершить” (submit). It will change your random seed. Or write the better code with all alive paladins :wink:


May be because i modified code adding:
before while.

How I can check the fact of ressurect? I tried by checking number of paladins, or their’s name, or enemy name’s. But when hero saying something - this problem doesn’t appear.

So i passed this level with no optimal code including hero.say("message") before while loop (-:


You can see if a paladin has died and then was resurected. She also should have an effect mark above the head.


I believe you can check if the paladin has been resurrected by checking paladin.hasEffect(“raise-dead”), I could be wrong though - never really tried it, just pure guess :slight_smile:


I have a poor graphics speed, so cannot understand who is whom sometimes. I checked several times without hero.say, and once saw the skull on some unit. I think - you are right about resurected, but i don’t understand way hero.say can help paladin not to be resurected


Good guess, I checked it, but no (-:


Hero.say action takes 1s (check description, Action name: “say”. Takes: 1s) so your code simulates your hero speaking for 1s, halting all further actions for that time - thus it affects the outcome of the battle :slight_smile: something to keep in mind - don’t use hero.say for debugging purposes during a battle, most of the time :slight_smile:


I had the same problem: "command’s argument minion should have type unit, but not object: XXX. Hero Placeholder (team humans) can’t command XXX (team ogres)"
I was decided it by add check: if == “humans”