[SOLVED] The Two Flowers Help

Getting error on line 16 methodname has a problem how do i fix this thanks

// If the peasant is damaged, the flowers will shrink!

function summonSoldiers() {
    friends = hero.findFriends();
    if (hero.gold >= hero.costOf("soldier")) {
        hero.summon("soldier");
    }
}

// Define the function: commandSoldiers
function commandSoldiers() {
    friends = hero.findFriends();
    for (var i = 0; i < friends.length ; i++) {
        var enemy = friends[i].findNearestEnemy();
        if (enemy) {
            hero.command(friends[i], "attack", enemy);
        }
    }
}
// Define the function: pickUpNearestCoin
function pickUpNearestCoin() {
    
}

var peasant = hero.findByType("peasant")[0];
var friends = hero.findFriends();
while(true) {
    summonSoldiers();
    // commandSoldiers();
    commandSoldiers();
    // pickUpNearestCoin();
    pickUpNearestCoin();
    
}

2 questions 1 which area and 2 wich kind of code you using

2 comments 1 just use direct link 2 the kind of code is obvious based on its structure

so its python? or java

Javascript (20000000000000000 chars)

You need to fill in the function picknearestCoin();, the reason you are getting the error is because you are calling an empty function

CloudRip Mountain Javascript

I tried commenting out the code but the problem persists

// If the peasant is damaged, the flowers will shrink!

function summonSoldiers() {
    friends = hero.findFriends();
    if (hero.gold >= hero.costOf("soldier")) {
        hero.summon("soldier");
    }
}

// Define the function: commandSoldiers
function commandSoldiers() {
    friends = hero.findFriends();
    for (var i = 0; i < friends.length ; i++) {
        var enemy = friends[i].findNearestEnemy();
        if (enemy) {
            hero.command(friends[i], "attack", enemy);
        }
    }
}
// Define the function: pickUpNearestCoin
//function pickUpNearestCoin() {
//    
//}

var peasant = hero.findByType("peasant")[0];
var friends = hero.findFriends();
while(true) {
    summonSoldiers();
    // commandSoldiers();
    commandSoldiers();
    // pickUpNearestCoin();
    //pickUpNearestCoin();
    
}

Hi @Christian_K, your problem’s in this function:

You’ve called the function “commandSoldiers”, but who are you really commanding?
Think who the function: hero.findFriends(); will return. Read the description of your Boss Star to see who it can summon / command.
After you’ve fixed that you just need to write your pickUpNearestCoin() function and you’re done. (I’ve checked you’re code and there aren’t any other errors.)
:lion: :lion: :lion:

thanks that fixed the problem for me