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

**URL:** <https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170>\
**Category:** Level Help\
**Created:** [March 28, 2021, 11:08pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170 "2021-03-28T23:08:28Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anton\_Vinogradov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anton_vinogradov/32/19802_2.png) [@Anton\_Vinogradov](https://discourse.codecombat.com/u/Anton_Vinogradov)\
**Post date:** [March 28, 2021, 11:08pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/1 "2021-03-28T23:08:28Z")

</div>

Hello!  
Please help understand why do I get this error:  
 ![Screenshot 2021-03-29 020639](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/5/4/5406c334a9ba8878771e28ff157d4aad65090381.png)  
Code:

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

```

---

<div class="post-metadata">

**Author:** ![thebagel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thebagel/32/22241_2.png) [@thebagel](https://discourse.codecombat.com/u/thebagel)\
**Post date:** [March 28, 2021, 11:09pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/2 "2021-03-28T23:09:03Z")

</div>

You can’t command enemies

---

<div class="post-metadata">

**Author:** ![thebagel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thebagel/32/22241_2.png) [@thebagel](https://discourse.codecombat.com/u/thebagel)\
**Post date:** [March 28, 2021, 11:09pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/3 "2021-03-28T23:09:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [March 28, 2021, 11:12pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/4 "2021-03-28T23:12:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Tang](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eric_tang/32/15310_2.png) [@Eric\_Tang](https://discourse.codecombat.com/u/Eric_Tang)\
**Post date:** [March 28, 2021, 11:37pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/5 "2021-03-28T23:37:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CocoCharlie](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cococharlie/32/19081_2.png) [@CocoCharlie](https://discourse.codecombat.com/u/CocoCharlie)\
**Post date:** [March 29, 2021, 12:05am UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/6 "2021-03-29T00:05:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CocoCharlie](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cococharlie/32/19081_2.png) [@CocoCharlie](https://discourse.codecombat.com/u/CocoCharlie)\
**Post date:** [March 29, 2021, 12:06am UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/7 "2021-03-29T00:06:04Z")

</div>

> [@milton.jinich](#):
>
> You can’t command enemies

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

---

<div class="post-metadata">

**Author:** ![thebagel](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thebagel/32/22241_2.png) [@thebagel](https://discourse.codecombat.com/u/thebagel)\
**Post date:** [March 29, 2021, 12:42am UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/8 "2021-03-29T00:42:42Z")

</div>

> [@Anton\_Vinogradov](#):
>
> `for ss in soldiers:`

Maybe you’ve defined ss as an enemy above?

---

<div class="post-metadata">

**Author:** ![CocoCharlie](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cococharlie/32/19081_2.png) [@CocoCharlie](https://discourse.codecombat.com/u/CocoCharlie)\
**Post date:** [March 29, 2021, 1:18am UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/9 "2021-03-29T01:18:35Z")

</div>

No, that’s fine I think.

---

<div class="post-metadata">

**Author:** ![Hin\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hin_lee/32/20147_2.png) [@Hin\_Lee](https://discourse.codecombat.com/u/Hin_Lee)\
**Post date:** [March 29, 2021, 2:11pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/10 "2021-03-29T14:11:13Z")

</div>

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

> [@Anton\_Vinogradov](#):
>
> ` soldiers = hero.findByType("soldier")`

with

```python
soldiers = hero.findByType("soldier", hero.findFriends())

```

---

<div class="post-metadata">

**Author:** ![CocoCharlie](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/cococharlie/32/19081_2.png) [@CocoCharlie](https://discourse.codecombat.com/u/CocoCharlie)\
**Post date:** [March 29, 2021, 4:04pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/11 "2021-03-29T16:04:58Z")

</div>

Ohhhh, interesting idea. That’s probably right

---

<div class="post-metadata">

**Author:** ![Anton\_Vinogradov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anton_vinogradov/32/19802_2.png) [@Anton\_Vinogradov](https://discourse.codecombat.com/u/Anton_Vinogradov)\
**Post date:** [March 29, 2021, 6:08pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/12 "2021-03-29T18:08:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [March 29, 2021, 6:33pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/13 "2021-03-29T18:33:49Z")

</div>

> [@Anton\_Vinogradov](#):
>
> Clearly wrong type.

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

---

<div class="post-metadata">

**Author:** ![Anton\_Vinogradov](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/anton_vinogradov/32/19802_2.png) [@Anton\_Vinogradov](https://discourse.codecombat.com/u/Anton_Vinogradov)\
**Post date:** [March 29, 2021, 6:58pm UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/14 "2021-03-29T18:58:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/a/a9445509d1a758c41b5ddcddc8c8e20a5dedb67f.png) [@system](https://discourse.codecombat.com/u/system)\
**Post date:** [March 30, 2021, 6:58am UTC](https://discourse.codecombat.com/t/summit-s-gate-trying-to-command-ogres-solved/28170/15 "2021-03-30T06:58:51Z")

</div>

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