Help with summit's gate

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();
}

what hero and equipment are you using

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

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

oh just say if enemy before commanding them to attack

i did it i wrote if before it

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);
        }
    }
};

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

oh thanks you so much :)))

your welcome (20 chars)

nvm got another problem lol

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

there says “u need something to cast upon”

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

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

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

no!!! (clear sentance)