Timber turncoat help!

Hi Kaleb_Aziz,

Info about the trust levels here:

1 Like

Oh, sorry about that. I think I was distracted with other posts and didnā€™t take note of how old the first post was. I think the article that jka shared should help with your question on number of postsā€¦and of course, since you are not the originator, you cannot edit the title or set the topic to solved. Iā€™ll do so, on your behalf, this time.

1 Like

I canā€™t get my code to work.
My code:

while True:
    # Collect gold.
    gold = hero.findItems()
    if gold:
        hero.move(gold.pos)
    # If you have enough gold, summon a soldier.
    if hero.gold > costOf("soldier"):
        hero.summon("soldier")
    # Use a for-loop to command each soldier.
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            # If there's an enemy, command her to attack.
            # Careful! If your soldiers are defeated, a warlock will appear!
            # Otherwise, move her to the right side of the map.
            if enemy:
                hero.command(friend, "attack", enemy)
            else:
                hero.command(friend, "move", hero.pos)
            

change that to gold = hero.findNearestItem()

When I build a soldier and tell it to move, the soldier is not moving and only I am.

can you show me your code becaue J_F_B_M is not active

1 Like