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

Boring thing and more

Continuing the discussion from Restless dead - it's restless:

1 Like

Have you solved it yet, if you have can you please help me.

def commandSoldiers():
    if hero.gold >= hero.costOf("soldier"):
        hero.summon("soldier")
    for friend in hero.findFriends():
        if friend.type == "soldier":
            enemy = friend.findNearestEnemy()
            if enemy:
                hero.command(friend, "attack", enemy)

def collectCoins(): 
    coin = hero.findNearestItem()
    if coin:
        hero.move(coin.pos)

hero.moveXY(55, 18)
enemyuser = hero.findNearestEnemy()
if enemyuser:
    
    if hero.isReady("bash"):
        hero.bash(enemyuser)
    else:
        hero.attack(enemyuser)
hero.moveXY(19, 40)

while True:
    collectCoins()
    commandSoldiers()
    enemyuser = hero.findNearestEnemy()
    if enemyuser:
        
        if hero.isReady("bash"):
            hero.bash(enemyuser)
        else:
            hero.attack(enemyuser)
1 Like

@Lydia_Song please do not post the same question in multiple topics. Doing so will not get you help any faster and it will clutter up the board.

Please continue this discussion in the original topic.

Ok :slight_smile: (2020202020)

2 Likes