# Help with summit's gate

**URL:** <https://discourse.codecombat.com/t/help-with-summits-gate/35356>\
**Category:** Level Help\
**Created:** [April 13, 2023, 6:05pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356 "2023-04-13T18:05:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:05pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/1 "2023-04-13T18:05:20Z")

</div>

```python
hero.moveXY(92, 55);
hero.attack('Catapult');
hero.attack('Catapult');
hero.moveXY(92, 12);
hero.attack('Catapult 1');
hero.attack('Catapult 1');
hero.moveXY(60, 34);
hero.jumpBash = function () {
    var enemy = hero.findNearest(hero.findEnemies());
    if (enemy && hero.isReady("jump") && hero.isReady("bash")) {
        hero.jumpTo(enemy);
        hero.bash(enemy);
    }
};
hero.oof = function () {
    var enemy = hero.findNearest(hero.findEnemies());
    if (enemy) {
        hero.attack(enemy);
    }
    if (hero.canCast("chain-lightning", enemy)) {
        hero.cast("chain-lightning", enemy);
    }
};
hero.summonSoldier = function () {
    if (hero.gold >= hero.costOf("griffin-rider")) {
        hero.summon("griffin-rider");
    }
};
hero.commandSoldier = function () {
    var friend = hero.findFriends();
    var enemy = hero.findNearest(hero.findEnemies());
    if (friend) {
        for (var i = 0; i < friend.length; i += 1) {
            hero.command(friend[i], "attack", enemy);
        }
    }
};
hero.commandPaladin = function () {
    var friend = hero.findByType("paladin");
    var enemy = hero.findNearest(hero.findEnemies());
    if (friend) {
        for (var s = 0; s < friend.length; s += 1) {
            hero.command(friend[s], "cast", "heal", hero);
        }
    }
};
hero.PickupItems = function () {
    var item = hero.findNearest(hero.findItems());
    if (item) {
        hero.move(item.pos);
    }
};
hero.Wait = function () {
    if (hero.pos.x > 216) {
        hero.wait(10);
    }
};
while (true) {
    hero.summonSoldier();
    hero.commandSoldier();
    hero.commandPaladin();
    hero.jumpBash();
    hero.oof();
    if (hero.pos.x > 249) {
        break;
    }
}
var tt = true;
while (tt) {
    var enemy = hero.findNearest(hero.findEnemies());
    if (enemy && enemy.type === 'Warlock') {
        hero.attack(enemy);
    }
    if (hero.pos.x > 272) {
        hero.moveXY(277, 57);
        hero.attack('Vax');
        hero.attack('Vax');
        hero.moveXY(276, 8);
        hero.attack('Vyrryx');
        hero.attack('Vyrryx');
        hero.attack('Vyrryx');
        hero.attack('Yzzrith');
    }
    var tt = false;
}
while (true) {
    hero.PickupItems();
    hero.summonSoldier();
    hero.commandSoldier();
    hero.commandPaladin();
    hero.jumpBash();
    hero.oof();
}

```

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:05pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/2 "2023-04-13T18:05:55Z")

</div>

what hero and equipment are you using

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:06pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/3 "2023-04-13T18:06:41Z")

</div>

free hero, dragon armor but helmet and sword of the forgotten

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:07pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/4 "2023-04-13T18:07:40Z")

</div>

i need help cz in the command soldier function it says “is there everytime a enemy to attack? try using if” or some stuff like that but i used it

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:09pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/5 "2023-04-13T18:09:09Z")

</div>

oh just say if enemy before commanding them to attack

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:09pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/6 "2023-04-13T18:09:52Z")

</div>

i did it i wrote if before it

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:10pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/7 "2023-04-13T18:10:29Z")

</div>

```python
hero.commandSoldier = function () {
    var friend = hero.findFriends();
    var enemy = hero.findNearest(hero.findEnemies());
    if (friend) {
        for (var i = 0; i < friend.length; i += 1) {
            hero.command(friend[i], "attack", enemy);
        }
    }
};

```

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:10pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/8 "2023-04-13T18:10:43Z")

</div>

you say if friend you need to say if friend and enemy

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:11pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/9 "2023-04-13T18:11:16Z")

</div>

oh thanks you so much :)))

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:11pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/10 "2023-04-13T18:11:54Z")

</div>

your welcome (20 chars)

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:12pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/11 "2023-04-13T18:12:22Z")

</div>

nvm got another problem lol

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:12pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/12 "2023-04-13T18:12:56Z")

</div>

```python
    if (hero.canCast("chain-lightning", enemy)) {
        hero.cast("chain-lightning", enemy);
    }
};

```

there says “u need something to cast upon”

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:14pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/13 "2023-04-13T18:14:15Z")

</div>

say if enemy and hero.canCast(“chain-lightning”,enemy)

---

<div class="post-metadata">

**Author:** ![TheDepressedOne](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thedepressedone/32/34068_2.png) [@TheDepressedOne](https://discourse.codecombat.com/u/TheDepressedOne)\
**Post date:** [April 13, 2023, 6:14pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/14 "2023-04-13T18:14:34Z")

</div>

oh right everytime the if sorry code so long that i forgot it

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:20pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/17 "2023-04-13T18:20:36Z")

</div>

sry not really i used Ritic but I do say that you should use the catapults to your advantage

---

<div class="post-metadata">

**Author:** ![TheCodingCrusader22](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/thecodingcrusader22/32/46084_2.png) [@TheCodingCrusader22](https://discourse.codecombat.com/u/TheCodingCrusader22)\
**Post date:** [April 13, 2023, 6:21pm UTC](https://discourse.codecombat.com/t/help-with-summits-gate/35356/18 "2023-04-13T18:21:09Z")

</div>

no!!! (clear sentance)
