Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Mountain Mercenaries Help - Cloudrip Mountain

Hi, I’m not sure what’s wrong with my code. This code allows my character to summon 1 soldier, but he doesn’t do anything. What’s more, an error pops up. Error: ‘ArgumentError: command’s argument minion should have type unit, but got null

while(true) {
    // Move to the nearest coin.
    // Use move instead of moveXY so you can command constantly.
    var coin = hero.findNearestItem();
    hero.say("I need coins!");
    // If you have funds for a soldier, summon one.
    if ( > hero.costOf("soldier")) {
        hero.say("I should summon something here!");
    var enemy = hero.findNearest(hero.findEnemies());
    if (enemy) {
        var soldiers = hero.findFriends();
        var soldierIndex = 0;
        var soldier = soldiers[soldierIndex];
        // Loop over all your soldiers and order them to attack.
        while (soldierIndex < 10) {
            hero.command(soldier, "attack", enemy);
            // Use the 'attack' command to make your soldiers attack.
            //hero.command(soldier, "attack", enemy);

Hi! You need to summon a soldier in a different place from where your doing it at the moment. At the moment your summoning a soldier when you don’t know if you have enough money to summon it. Look at this line:

At the moment your commanding a soldier that you defined before you summoned it. So when you defined the variable soldier, you didn’t have any, meaning it’s contents is null.
You also need to increment (increase by one) soldierIndex at the end of your while loop so that you command more than one soldier.

@Deadpool198 i told u how to get the level 66 items

Did you? I don’t remember this happening. :smile:

So your mastake is… wait what? oops, i dont do c ++.

wait wait wait, oof thats javascript