Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Hero wont summon and gettin an error

@dedreous bro you there?

Hi, I’ve noticed a few errors by looking at your code. Firstly this line:

I think that one will probably jump out at you. :grin:
Secondly: although this may not be an error, I think your for-loop for commanding the troops is a little bit… iffy. It just looks like it’s about to cause an error, to me, at least. I might suggest an alternative to differentiate between your archers and your paladins:

for friend in friends:
    enemy = hero.findNearestEnemy()
    if friend.type == "paladin":
        if paladin.canCast("heal", lowest):
            hero.command(paladin, "cast", "heal", lowest)
    elif friend.type == "archer":
        if enemy:
            hero.command(archer, "attack", enemy)

Another note, just for tactics, I would make your paladins shield when they’re not healing. It will make them last about 5x longer.
I hope this helps,

1 Like

I am now :wink:

Turns out, my test account is on level 5, so gonna have to wing it.

@Deadpool198, good catch!..I was so busy trying to see if I could duplicate, I didn’t see that one, right off.

thanks guys for your help. I checked in on this and I fixed my code by adding some archer and paladin functions and my code worked out well. Gonna see how many levels my hero can last.