Summit’s Gate: trying to command ogres [SOLVED]

Hello!
Please help understand why do I get this error:
Screenshot 2021-03-29 020639
Code:

    soldiers = hero.findByType("soldier")
    warlock = hero.findNearest(hero.findByType("warlock"))
    if warlock:
        for ss in soldiers:
            hero.command(ss, "attack", warlock)
            pass
2 Likes

You can’t command enemies

Also, if you’re commanding the soldiers, you need soldiers[i]

You can’t command enemies. You have to be team ogres in order to command ogres.

Actually no. You don’t need to do that. @Anton_Vinogradov is that your full code?

1 Like

I actually don’t know why you’re getting that error @Anton_Vinogradov

He’s not trying to. Look at the code. The name of the topic just got mixed up.

Maybe you’ve defined ss as an enemy above?

No, that’s fine I think.

Actually, a warlock might have cast raise-dead on them, so they are on team “ogres”.So you have to replace

with

soldiers = hero.findByType("soldier", hero.findFriends())
1 Like

Ohhhh, interesting idea. That’s probably right

bingo!
That solved my issue.
@Hin_Lee, thanks for your idea! :smiley:
(Not sure if this should be treated as a bug? At least I’m looking for soldiers. And get ogre. Clearly wrong type. :thinking:)

1 Like

Hi!
team.ogres != type.ogre ))

Ok. Team and type. I see. Thanks to you all, guys!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.