# Summits Gate (Need Help)

**URL:** <https://discourse.codecombat.com/t/summits-gate-need-help/12886>\
**Category:** Uncategorized\
**Created:** [November 6, 2017, 10:18pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886 "2017-11-06T22:18:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 6, 2017, 10:18pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/1 "2017-11-06T22:18:14Z")

</div>

Here is my code, I can’t figure out what I’m doing wrong. Can someone help me out?

var enemies, enemy;

var summonTypes = [“archer”];  
this.summonTroops = function() {  
var type = summonTypes[this.built.length % summonTypes.length];  
if(this.gold \>= this.costOf(type)) {  
this.summon(type);  
}  
};

this.lowestHealthPaladin = function() {  
var lowestHealth = 99999;  
var lowestFriend = null;  
var friends = this.findFriends();  
for(var f=0; f \< friends.length; f++) {  
var friend = friends[f];  
if(friend.health \< lowestHealth && friend.health \< friend.maxHealth) {  
lowestHealth = friend.health;  
lowestFriend = friend;  
}  
}  
return lowestFriend;  
};

this.commandPaladin = function(paladin) {  
var healTarget = this.lowestHealthPaladin();  
enemy = paladin.findNearest(enemies);  
if (this.health \< this.maxHealth && paladin.canCast(“heal”)) {  
this.command(paladin, “cast”, “heal”, this);  
} else if (enemy) {  
this.command(paladin, “attack”, enemy);  
}  
};

this.commandSoldier = function(soldier) {  
enemy = soldier.findNearest(enemies);  
if (enemy) {  
this.command(soldier, “attack”, enemy);  
} else {  
this.command(soldier, “move”, {x: soldier.pos.x+10, y: soldier.pos.y});  
}  
};

this.commandArcher = function(archer) {  
enemy = archer.findNearest(enemies);  
if (enemy) {  
this.command(archer, “attack”, enemy);  
} else {  
this.command(archer, “move”, {x: archer.pos.x+5, y: archer.pos.y});  
}  
};

this.commandGriffin = function(griffin) {  
enemy = griffin.findNearest(enemies);  
if (enemy) {  
this.command(griffin, “attack”, enemy);  
} else {  
this.command(griffin, “move”, {x: griffin.pos.x+10, y: griffin.pos.y});  
}  
};

this.commandFriends = function() {  
var friends = this.findFriends();  
for(var i=0; i \< friends.length; i++) {  
var friend = friends[i];  
if(friend.type == “soldier”) {  
this.commandSoldier(friend);  
} else if(friend.type == “archer”) {  
this.commandArcher(friend);  
} else if(friend.type == “griffin-rider”) {  
this.commandGriffin(friend);  
} else if(friend.type == “paladin”) {  
this.commandPaladin(friend);  
}  
}  
};

this.heroPlan = function () {  
enemy = this.findNearest(enemies);  
var catapult = this.findNearest(this.findByType(“catapult”));  
if (catapult) {  
enemy = catapult;  
} else {  
var nearestX = 101;  
for (var i; i \< enemies.length; i++) {  
if (enemies[i].pos.x \< nearestX) {  
nearestX == enemies[i].pos.x;  
enemy = enemies[i];  
}  
}  
}  
if (enemy) {  
this.attack(enemy);  
}  
else if (this.health == this.maxHealth) {  
this.moveXY(hero.pos.x + 10, hero.pos.y + 1);  
}  
};

this.saveFriendsLeft = function () {  
var friends = this.findFriends();  
for(var i=0; i \< friends.length; i++) {  
var friend = friends[i];  
if (friend) this.command(friend, “move”, {x: 0, y: 40});  
}  
};  
loop {  
var friend = this.findFriends();  
enemies = this.findEnemies();  
var catapult = this.findNearest(this.findByType(“catapult”));  
if (catapult) {  
this.saveFriendsLeft();  
} else this.commandFriends();  
this.summonTroops();  
this.heroPlan();  
enemy = this.findNearestEnemy();  
var warlock = this.findNearest(this.findByType(“warlock”));  
var chieftain = this.findNearest(this.findByType(“chieftain”));  
if (chieftain) {  
while (chieftain.health \> 0) {  
this.attack(chieftain);  
if (this.isReady(“chain-lightning”)) {  
this.cast(“chain-lightning”, chieftain);  
}  
if (this.isReady(“bash”)) {  
this.bash(chieftain);  
}  
if (friend) {  
hero.command(friend, “attack”, chieftain);  
}  
}  
}  
}

P.S: My equipment includes: Softened Leather Boots; Sword of the Temple; Emperors Gloves; Simple Wristwatch; Leather Belt; Programmication IV; Enchanted Lenses; Quarts Sense Stone; Boss Star III; Worn Dragonplate Helm; Enameled Dragonplate Chestplate; Crude Spike.

---

<div class="post-metadata">

**Author:** ![Xzanos](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xzanos/32/6985_2.png) [@Xzanos](https://discourse.codecombat.com/u/Xzanos)\
**Post date:** [November 6, 2017, 11:02pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/2 "2017-11-06T23:02:16Z")

</div>

Are you doing Python or JAVA Script?

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 6, 2017, 11:06pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/3 "2017-11-06T23:06:21Z")

</div>

i’m doing Javascript

---

<div class="post-metadata">

**Author:** ![Xzanos](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xzanos/32/6985_2.png) [@Xzanos](https://discourse.codecombat.com/u/Xzanos)\
**Post date:** [November 6, 2017, 11:08pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/4 "2017-11-06T23:08:03Z")

</div>

You also need to use  
[https://screenshots.firefoxusercontent.com/images/29e4f42a-fce0-446c-9027-e4df97196d99.png](https://screenshots.firefoxusercontent.com/images/29e4f42a-fce0-446c-9027-e4df97196d99.png)  
So I can see your code corectly. As far as I see you need to put spaces on your code with the {

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 6, 2017, 11:32pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/5 "2017-11-06T23:32:37Z")

</div>

FINE!!

> var enemies, enemy;

var summonTypes = [“archer”];  
this.summonTroops = function() {  
var type = summonTypes[this.built.length % summonTypes.length];  
if(this.gold \>= this.costOf(type)) {  
this.summon(type);  
}  
};

this.lowestHealthPaladin = function() {  
var lowestHealth = 99999;  
var lowestFriend = null;  
var friends = this.findFriends();  
for(var f=0; f \< friends.length; f++) {  
var friend = friends[f];  
if(friend.health \< lowestHealth && friend.health \< friend.maxHealth) {  
lowestHealth = friend.health;  
lowestFriend = friend;  
}  
}  
return lowestFriend;  
};

this.commandPaladin = function(paladin) {  
var healTarget = this.lowestHealthPaladin();  
enemy = paladin.findNearest(enemies);  
if (this.health \< this.maxHealth && paladin.canCast(“heal”)) {  
this.command(paladin, “cast”, “heal”, this);  
} else if (enemy) {  
this.command(paladin, “attack”, enemy);  
}  
};

this.commandSoldier = function(soldier) {  
enemy = soldier.findNearest(enemies);  
if (enemy) {  
this.command(soldier, “attack”, enemy);  
} else {  
this.command(soldier, “move”, {x: soldier.pos.x+10, y: soldier.pos.y});  
}  
};

this.commandArcher = function(archer) {  
enemy = archer.findNearest(enemies);  
if (enemy) {  
this.command(archer, “attack”, enemy);  
} else {  
this.command(archer, “move”, {x: archer.pos.x+5, y: archer.pos.y});  
}  
};

this.commandGriffin = function(griffin) {  
enemy = griffin.findNearest(enemies);  
if (enemy) {  
this.command(griffin, “attack”, enemy);  
} else {  
this.command(griffin, “move”, {x: griffin.pos.x+10, y: griffin.pos.y});  
}  
};

this.commandFriends = function() {  
var friends = this.findFriends();  
for(var i=0; i \< friends.length; i++) {  
var friend = friends[i];  
if(friend.type == “soldier”) {  
this.commandSoldier(friend);  
} else if(friend.type == “archer”) {  
this.commandArcher(friend);  
} else if(friend.type == “griffin-rider”) {  
this.commandGriffin(friend);  
} else if(friend.type == “paladin”) {  
this.commandPaladin(friend);  
}  
}  
};

this.heroPlan = function () {  
enemy = this.findNearest(enemies);  
var catapult = this.findNearest(this.findByType(“catapult”));  
if (catapult) {  
enemy = catapult;  
} else {  
var nearestX = 101;  
for (var i; i \< enemies.length; i++) {  
if (enemies[i].pos.x \< nearestX) {  
nearestX == enemies[i].pos.x;  
enemy = enemies[i];  
}  
}  
}  
if (enemy) {  
this.attack(enemy);  
}  
else if (this.health == this.maxHealth) {  
this.moveXY(hero.pos.x + 10, hero.pos.y + 1);  
}  
};

this.saveFriendsLeft = function () {  
var friends = this.findFriends();  
for(var i=0; i \< friends.length; i++) {  
var friend = friends[i];  
if (friend) this.command(friend, “move”, {x: 0, y: 40});  
}  
};  
loop {  
var friend = this.findFriends();  
enemies = this.findEnemies();  
var catapult = this.findNearest(this.findByType(“catapult”));  
if (catapult) {  
this.saveFriendsLeft();  
} else this.commandFriends();  
this.summonTroops();  
this.heroPlan();  
enemy = this.findNearestEnemy();  
var warlock = this.findNearest(this.findByType(“warlock”));  
var chieftain = this.findNearest(this.findByType(“chieftain”));  
if (chieftain) {  
while (chieftain.health \> 0) {  
this.attack(chieftain);  
if (this.isReady(“chain-lightning”)) {  
this.cast(“chain-lightning”, chieftain);  
}  
if (this.isReady(“bash”)) {  
this.bash(chieftain);  
}  
if (friend) {  
hero.command(friend, “attack”, chieftain);  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 6, 2017, 11:34pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/6 "2017-11-06T23:34:30Z")

</div>

OOPS

> var enemies, enemy;  
> var summonTypes = [“archer”];  
> this.summonTroops = function() {  
> var type = summonTypes[this.built.length % summonTypes.length];  
> if(this.gold \>= this.costOf(type)) {  
> this.summon(type);  
> }  
> };  
> this.lowestHealthPaladin = function() {  
> var lowestHealth = 99999;  
> var lowestFriend = null;  
> var friends = this.findFriends();  
> for(var f=0; f \< friends.length; f++) {  
> var friend = friends[f];  
> if(friend.health \< lowestHealth && friend.health \< friend.maxHealth) {  
> lowestHealth = friend.health;  
> lowestFriend = friend;  
> }  
> }  
> return lowestFriend;  
> };  
> this.commandPaladin = function(paladin) {  
> var healTarget = this.lowestHealthPaladin();  
> enemy = paladin.findNearest(enemies);  
> if (this.health \< this.maxHealth && paladin.canCast(“heal”)) {  
> this.command(paladin, “cast”, “heal”, this);  
> } else if (enemy) {  
> this.command(paladin, “attack”, enemy);  
> }  
> };  
> this.commandSoldier = function(soldier) {  
> enemy = soldier.findNearest(enemies);  
> if (enemy) {  
> this.command(soldier, “attack”, enemy);  
> } else {  
> this.command(soldier, “move”, {x: soldier.pos.x+10, y: soldier.pos.y});  
> }  
> };  
> this.commandArcher = function(archer) {  
> enemy = archer.findNearest(enemies);  
> if (enemy) {  
> this.command(archer, “attack”, enemy);  
> } else {  
> this.command(archer, “move”, {x: archer.pos.x+5, y: archer.pos.y});  
> }  
> };  
> this.commandGriffin = function(griffin) {  
> enemy = griffin.findNearest(enemies);  
> if (enemy) {  
> this.command(griffin, “attack”, enemy);  
> } else {  
> this.command(griffin, “move”, {x: griffin.pos.x+10, y: griffin.pos.y});  
> }  
> };  
> this.commandFriends = function() {  
> var friends = this.findFriends();  
> for(var i=0; i \< friends.length; i++) {  
> var friend = friends[i];  
> if(friend.type == “soldier”) {  
> this.commandSoldier(friend);  
> } else if(friend.type == “archer”) {  
> this.commandArcher(friend);  
> } else if(friend.type == “griffin-rider”) {  
> this.commandGriffin(friend);  
> } else if(friend.type == “paladin”) {  
> this.commandPaladin(friend);  
> }  
> }  
> };  
> this.heroPlan = function () {  
> enemy = this.findNearest(enemies);  
> var catapult = this.findNearest(this.findByType(“catapult”));  
> if (catapult) {  
> enemy = catapult;  
> } else {  
> var nearestX = 101;  
> for (var i; i \< enemies.length; i++) {  
> if (enemies[i].pos.x \< nearestX) {  
> nearestX == enemies[i].pos.x;  
> enemy = enemies[i];  
> }  
> }  
> }  
> if (enemy) {  
> this.attack(enemy);  
> }  
> else if (this.health == this.maxHealth) {  
> this.moveXY(hero.pos.x + 10, hero.pos.y + 1);  
> }  
> };  
> this.saveFriendsLeft = function () {  
> var friends = this.findFriends();  
> for(var i=0; i \< friends.length; i++) {  
> var friend = friends[i];  
> if (friend) this.command(friend, “move”, {x: 0, y: 40});  
> }  
> };  
> loop {  
> var friend = this.findFriends();  
> enemies = this.findEnemies();  
> var catapult = this.findNearest(this.findByType(“catapult”));  
> if (catapult) {  
> this.saveFriendsLeft();  
> } else this.commandFriends();  
> this.summonTroops();  
> this.heroPlan();  
> enemy = this.findNearestEnemy();  
> var warlock = this.findNearest(this.findByType(“warlock”));  
> var chieftain = this.findNearest(this.findByType(“chieftain”));  
> if (chieftain) {  
> while (chieftain.health \> 0) {  
> this.attack(chieftain);  
> if (this.isReady(“chain-lightning”)) {  
> this.cast(“chain-lightning”, chieftain);  
> }  
> if (this.isReady(“bash”)) {  
> this.bash(chieftain);  
> }  
> if (friend) {  
> hero.command(friend, “attack”, chieftain);  
> }  
> }  
> }  
> }

---

<div class="post-metadata">

**Author:** ![Adam\_King](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/adam_king/32/2705_2.png) [@Adam\_King](https://discourse.codecombat.com/u/Adam_King)\
**Post date:** [November 6, 2017, 11:54pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/7 "2017-11-06T23:54:39Z")

</div>

I think he meant the \</\>

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 7, 2017, 1:29am UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/8 "2017-11-07T01:29:25Z")

</div>

OK!!

```python
var enemies, enemy;
var summonTypes = [“archer”];
this.summonTroops = function() {
var type = summonTypes[this.built.length % summonTypes.length];
if(this.gold >= this.costOf(type)) {
this.summon(type);
}
};
this.lowestHealthPaladin = function() {
var lowestHealth = 99999;
var lowestFriend = null;
var friends = this.findFriends();
for(var f=0; f < friends.length; f++) {
var friend = friends[f];
if(friend.health < lowestHealth && friend.health < friend.maxHealth) {
lowestHealth = friend.health;
lowestFriend = friend;
}
}
return lowestFriend;
};
this.commandPaladin = function(paladin) {
var healTarget = this.lowestHealthPaladin();
enemy = paladin.findNearest(enemies);
if (this.health < this.maxHealth && paladin.canCast(“heal”)) {
this.command(paladin, “cast”, “heal”, this);
} else if (enemy) {
this.command(paladin, “attack”, enemy);
}
};
this.commandSoldier = function(soldier) {
enemy = soldier.findNearest(enemies);
if (enemy) {
this.command(soldier, “attack”, enemy);
} else {
this.command(soldier, “move”, {x: soldier.pos.x+10, y: soldier.pos.y});
}
};
this.commandArcher = function(archer) {
enemy = archer.findNearest(enemies);
if (enemy) {
this.command(archer, “attack”, enemy);
} else {
this.command(archer, “move”, {x: archer.pos.x+5, y: archer.pos.y});
}
};
this.commandGriffin = function(griffin) {
enemy = griffin.findNearest(enemies);
if (enemy) {
this.command(griffin, “attack”, enemy);
} else {
this.command(griffin, “move”, {x: griffin.pos.x+10, y: griffin.pos.y});
}
};
this.commandFriends = function() {
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if(friend.type == “soldier”) {
this.commandSoldier(friend);
} else if(friend.type == “archer”) {
this.commandArcher(friend);
} else if(friend.type == “griffin-rider”) {
this.commandGriffin(friend);
} else if(friend.type == “paladin”) {
this.commandPaladin(friend);
}
}
};
this.heroPlan = function () {
enemy = this.findNearest(enemies);
var catapult = this.findNearest(this.findByType(“catapult”));
if (catapult) {
enemy = catapult;
} else {
var nearestX = 101;
for (var i; i < enemies.length; i++) {
if (enemies[i].pos.x < nearestX) {
nearestX == enemies[i].pos.x;
enemy = enemies[i];
}
}
}
if (enemy) {
this.attack(enemy);
}
else if (this.health == this.maxHealth) {
this.moveXY(hero.pos.x + 10, hero.pos.y + 1);
}
};
this.saveFriendsLeft = function () {
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if (friend) this.command(friend, “move”, {x: 0, y: 40});
}
};
loop {
var friend = this.findFriends();
enemies = this.findEnemies();
var catapult = this.findNearest(this.findByType(“catapult”));
if (catapult) {
this.saveFriendsLeft();
} else this.commandFriends();
this.summonTroops();
this.heroPlan();
enemy = this.findNearestEnemy();
var warlock = this.findNearest(this.findByType(“warlock”));
var chieftain = this.findNearest(this.findByType(“chieftain”));
if (chieftain) {
while (chieftain.health > 0) {
this.attack(chieftain);
if (this.isReady(“chain-lightning”)) {
this.cast(“chain-lightning”, chieftain);
}
if (this.isReady(“bash”)) {
this.bash(chieftain);
}
if (friend) {
hero.command(friend, “attack”, chieftain);
}
}
}
}

```

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [November 7, 2017, 2:00am UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/9 "2017-11-07T02:00:36Z")

</div>

Close. Try copying it from the source - the Summit’s Gate level - and pasting it here just the way you did instead of copying it from this board. You’ll understand why as soon as you do; all the structure is retained and everyone can see it here exactly as it appears in the game.

You’re getting there.

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 7, 2017, 2:32pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/10 "2017-11-07T14:32:23Z")

</div>

thanks,

```python
var enemies, enemy;
var summonTypes = ["archer"];
this.summonTroops = function() {
var type = summonTypes[this.built.length % summonTypes.length];
if(this.gold >= this.costOf(type)) {
this.summon(type);
    }
};
this.lowestHealthPaladin = function() {
var lowestHealth = 99999;
var lowestFriend = null;
var friends = this.findFriends();
for(var f=0; f < friends.length; f++) {
var friend = friends[f];
if(friend.health < lowestHealth && friend.health < friend.maxHealth) {
lowestHealth = friend.health;
lowestFriend = friend;
        }
    }
return lowestFriend;
};
this.commandPaladin = function(paladin) {
var healTarget = this.lowestHealthPaladin();
enemy = paladin.findNearest(enemies);
if (this.health < this.maxHealth && paladin.canCast("heal")) {
this.command(paladin, "cast", "heal", this);
} else if (enemy) {
this.command(paladin, "attack", enemy);
    }
};
this.commandSoldier = function(soldier) {
enemy = soldier.findNearest(enemies);
if (enemy) {
this.command(soldier, "attack", enemy);
} else {
this.command(soldier, "move", {x: soldier.pos.x+10, y: soldier.pos.y});
    }
};
this.commandArcher = function(archer) {
enemy = archer.findNearest(enemies);
if (enemy) {
this.command(archer, "attack", enemy);
} else {
this.command(archer, "move", {x: archer.pos.x+5, y: archer.pos.y});
    }
};
this.commandGriffin = function(griffin) {
enemy = griffin.findNearest(enemies);
if (enemy) {
this.command(griffin, "attack", enemy);
} else {
this.command(griffin, "move", {x: griffin.pos.x+10, y: griffin.pos.y});
    }
};
this.commandFriends = function() {
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if(friend.type == "soldier") {
this.commandSoldier(friend);
} else if(friend.type == "archer") {
this.commandArcher(friend);
} else if(friend.type == "griffin-rider") {
this.commandGriffin(friend);
} else if(friend.type == "paladin") {
this.commandPaladin(friend);
        }
    }
};
this.heroPlan = function () {
enemy = this.findNearest(enemies);
var catapult = this.findNearest(this.findByType("catapult"));
if (catapult) {
enemy = catapult;
} else {
var nearestX = 101;
for (var i; i < enemies.length; i++) {
if (enemies[i].pos.x < nearestX) {
nearestX == enemies[i].pos.x;
enemy = enemies[i];
        }
    }
}
if (enemy) {
this.attack(enemy);
}
else if (this.health == this.maxHealth) {
this.moveXY(hero.pos.x + 10, hero.pos.y + 1);
    }
};
this.saveFriendsLeft = function () {
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if (friend) this.command(friend, "move", {x: 0, y: 40});
    }
};
loop {
var friend = this.findFriends();
enemies = this.findEnemies();
var catapult = this.findNearest(this.findByType("catapult"));
if (catapult) {
this.saveFriendsLeft();
} else this.commandFriends();
this.summonTroops();
this.heroPlan();
enemy = this.findNearestEnemy();
var warlock = this.findNearest(this.findByType("warlock"));
var chieftain = this.findNearest(this.findByType("chieftain"));
if (chieftain) {
while (chieftain.health > 0) {
this.attack(chieftain);
if (this.isReady("chain-lightning")) {
this.cast("chain-lightning", chieftain);
}
if (this.isReady("bash")) {
this.bash(chieftain);
}
if (friend) {
hero.command(friend, "attack", chieftain);
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![Adam\_King](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/adam_king/32/2705_2.png) [@Adam\_King](https://discourse.codecombat.com/u/Adam_King)\
**Post date:** [November 7, 2017, 2:50pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/11 "2017-11-07T14:50:43Z")

</div>

that is a lot better.

---

<div class="post-metadata">

**Author:** ![akodis](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@akodis](https://discourse.codecombat.com/u/akodis)\
**Post date:** [November 7, 2017, 2:53pm UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/12 "2017-11-07T14:53:44Z")

</div>

I keep dieing near the chieftain because he can’t figure out what friend or chieftain is.

---

<div class="post-metadata">

**Author:** ![Ironhead](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/ironhead/32/7384_2.png) [@Ironhead](https://discourse.codecombat.com/u/Ironhead)\
**Post date:** [November 8, 2017, 2:20am UTC](https://discourse.codecombat.com/t/summits-gate-need-help/12886/13 "2017-11-08T02:20:56Z")

</div>

What hero are you using?
