# Ace of Coders command help

**URL:** <https://discourse.codecombat.com/t/ace-of-coders-command-help/5054>\
**Category:** Uncategorized\
**Created:** [September 26, 2015, 11:24pm UTC](https://discourse.codecombat.com/t/ace-of-coders-command-help/5054 "2015-09-26T23:24:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eab201903977](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/eab201903977/32/3149_2.png) [@eab201903977](https://discourse.codecombat.com/u/eab201903977)\
**Post date:** [September 26, 2015, 11:24pm UTC](https://discourse.codecombat.com/t/ace-of-coders-command-help/5054/1 "2015-09-26T23:24:15Z")

</div>

In Ace of Coders, I tried to do this

```
 var friends = this.built;
 var soldiers = friends.findByType("soldier");

```

to separate my units. However, I get this error: tmp35[tmp36 is not a function]  
Any suggested fixes?

---

<div class="post-metadata">

**Author:** ![J\_F\_B\_M](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/j_f_b_m/32/2756_2.png) [@J\_F\_B\_M](https://discourse.codecombat.com/u/J_F_B_M)\
**Post date:** [September 27, 2015, 11:30pm UTC](https://discourse.codecombat.com/t/ace-of-coders-command-help/5054/2 "2015-09-27T23:30:48Z")

</div>

2 posts were merged into an existing topic: [Ace of Coders - Questions & Feedback](https://discourse.codecombat.com/t/ace-of-coders-questions-feedback/4957)

---

<div class="post-metadata">

**Author:** ![J\_F\_B\_M](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/j_f_b_m/32/2756_2.png) [@J\_F\_B\_M](https://discourse.codecombat.com/u/J_F_B_M)\
**Post date:** [September 28, 2015, 7:09pm UTC](https://discourse.codecombat.com/t/ace-of-coders-command-help/5054/3 "2015-09-28T19:09:57Z")

</div>

A post was merged into an existing topic: [Ace of Coders - Questions & Feedback](https://discourse.codecombat.com/t/ace-of-coders-questions-feedback/4957)

---

<div class="post-metadata">

**Author:** ![UltCombo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ultcombo/32/3822_2.png) [@UltCombo](https://discourse.codecombat.com/u/UltCombo)\
**Post date:** [October 10, 2015, 12:33am UTC](https://discourse.codecombat.com/t/ace-of-coders-command-help/5054/4 "2015-10-10T00:33:02Z")

</div>

`this.built` is an array and does not have a `findByType` method. Your hero has the `findByType` method. The code should be:

```python
var soldiers = this.findByType('soldier', this.built);
// OR:
var soldiers = this.built.filter(function(unit) { return unit.type === 'soldier'; });

```

However, note that `this.built` includes dead units. If you want only the alive ones you can use:

```python
var soldiers = this.findByType('soldier', this.findFriends());
// OR:
var soldiers = this.built.filter(function(unit) {
    return unit.type === 'soldier' && unit.health > 0;
});

```
