Help in Vital Power

Sorry if I asked too much but I really need help. Here is my code:

# The code inside a function is not executed immediately. It's saved for later.
# This function has your hero collect the nearest coin.
def pickUpNearestCoin():
    items = hero.findItems()
    nearestCoin = hero.findNearest(items)
    if nearestCoin:
        hero.move(nearestCoin.pos)

# This function has your hero summon a soldier.
def summonSoldier():
    # If hero.gold is greater than the cost of the "soldier":
    if hero.gold>=20:
        # Then summon a "soldier":
        hero.summon("soldier")
# This function commands your soldiers to attack their nearest enemy.
def commandSoldiers():
    for soldier in hero.findFriends():
        enemy = soldier.findNearestEnemy()
        if enemy:
            hero.command(soldier, "attack", enemy)

while True:
    # In your loop, you can "call" the functions defined above.
    # The following line causes the code inside the "pickUpNearestCoin" function to be executed.
    pickUpNearestCoin()
    # Call summonSoldier here
    summonSoldiers
    # Call commandSoldiers here
    commnadSoldiers

Plese post a link
20

here is the link:
CodeCombat - Coding games to learn Python and JavaScript?

Sorry my codecombat is not working right now.

here is the link: CodeCombat - Coding games to learn Python and JavaScript?

@milton.jinich I don’t get what your saying

Sorry wrong level, for this level it is all about gear can you show your gear.

here is my gear:

Show a screen shot of what happens when you play. Sorry if this is a lot, I just need o know what happens

here is what happened:

you havent defined this
like:

soldiers = hero.findNearesFriend()
#replace the hero.findFriends to to soldiers
# and then proceed your code

When you did the command commandSoldiers, you spelt it wrong when you were calling it.

Put a pair of parenthesis at the end of summonSoldiers and commandSoldiers. commandSoldiers is spelled wrong.

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

I finished this! Thanks for the advice!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.