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

Help! Restless Dead

Oh yeah I forgot its boss star 1 :rofl:

3 Likes

Also you can use

 if hero.isReady("envenom"):
     hero.envenom(enemy)
1 Like

No (200000 characters)

1 Like
while True:
    enemy = hero.findNearestEnemy()
    
    item = hero.findNearestItem()
    
    if enemy:
        
        if hero.isReady("throw"):
            hero.throw(enemy)
        
        else:
            if hero.isReady("envenom"):
                hero.envenom()
                
                hero.attack(enemy)
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)
    
    elif hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
        
        friends = hero.findFriends()
        if friends:
            for i in range(len(friends)):
                friend = friends[i]
                enemy1 = friend.findNearestEnemy
            if friend:
                if enemy1:
                    
                    hero.command(friend, "attack", enemy1)
        
    else:
        hero.moveXY(19, 40)
              


This is what it says for line 37

1 Like
while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if enemy:
        if hero.isReady("throw"):
            hero.throw(enemy)
        else:
            if hero.isReady("envenom"):
                hero.envenom()
                hero.attack(enemy)
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)
    elif hero.gold > hero.costOf("soldier"):
        hero.summon("soldier")
        hero.summon("soldier")
        hero.summon("soldier")
        friends = hero.findFriends()
        if friends:
            for i in range(len(friends)):
                friend = friends[i]
                enemy1 = friend.findNearestEnemy()
                if friend:
                    if enemy1:
                        hero.command(friend, "attack", enemy1)
            
    else:
        hero.moveXY(19, 40)

This is my code now, the first soldier that I summon actually moves to fight the skeletons, but for some reason, the rest doesn’t.

2 Likes

I can summon archers now, I got the boss star II.

2 Likes

I have the boss star II, but I don’t know how to use it. Someone please teach me.

while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if enemy:
        if hero.isReady("throw"):
            hero.throw(enemy)
        else:
            if hero.isReady("envenom"):
while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if enemy:
        if hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)
    elif hero.gold >= hero.costOf("archer"):
        hero.summon("archer")
        friends = hero.findFriends()
        if friends:
            for i in range(len(friends)):
                friend = friends[i]
                enemy1 = friend.findNearestEnemy()
                if enemy1:
                    hero.command(friend, "defend", {'x':55, 'y': 48})
    else:
        hero.moveXY(19, 40)

I’ve now switched to Gordon The Stalwart to see if he is any better, but in this code, I can only summon 1 archer in the very beginning, and I don’t collect all the coins.
CAN Anyone, ANYONE help ME! (I’ve been stuck on this level for 100000 Years)

2 Likes

I see a few problems first, your already check if hero.isReady() but you need to actually use it like hero.envenom() or something I never used Gordon.

Why is did you put 2 loop delete the first one and add it to the second.

I think it easier to use for loop its easier to use and more manageable, you can do something like this

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

If you have any more problems feel free to ask! :grin:

3 Likes

You forgot to write (If friend):

if friends:
            for i in range(len(friends)):
                friend = friends[i]
                if friend:
                  enemy1 = friend.findNearestEnemy()
                   if enemy1:
                        hero.command(friend, "defend", {'x':55, 'y': 48})
3 Likes

Here is my newest code, sorry for posting so often. :neutral_face: In this code, my archers finally attack the enemy. My hero just instantly gets crowded by the skeletons.But I keep dying. Is it my armor and hero, or is it my tactics?

while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if enemy:
        if hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)
    elif item:
        hero.moveXY(item.pos.x, item.pos.y)
    elif hero.gold >= hero.costOf("archer"):
        hero.summon("archer")
        
        friends = hero.findFriends()
        for friend in friends:
            if friend.type == "archer":
                enemy = friend.findNearestEnemy()
                if enemy:
                    
                    hero.command(friend, "attack", enemy)
    else:
        hero.moveXY(57, 24)
        hero.moveXY(19, 40)
        

This is my armor.

3 Likes

Archers are a bit weak for this level IMO. Especially because the rot general has the lightning beam. I would stick to soldiers.
Danny

5 Likes

Ok I will try that! :grin:

1 Like
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)

My new code, some of my soldiers move but they stop attacking for a while in the middle and start attacking again. Would flags be useful in this level?

1 Like

Your soldiers probably stop while you’re moving to bash an enemy, maybe remove that part… Or move() towards the enemy (not moveXY() which interrupts commands) and once you’re within 2 metres bash them.
Your code works for my wizard so there are no actual errors, from now on it’s just tactics I’m afraid.
If you could tell me what’s happening to your hero - how far you’re getting in the level, that would help.
Danny

2 Likes
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)
            else:
                hero.command(friend, "defend", {'x':63, 'y':57})

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

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

while True:
    collectCoins()
    commandSoldiers()
    enemyuser = hero.findNearestEnemy()
    if enemyuser:
        if hero.distanceTo(enemyuser) > 10:
            hero.move(enemyuser.pos)
        if hero.isReady("throw"):
            hero.throw(enemyuser)
        else:
            hero.attack(enemyuser)
    

This is my code now, I’m using Naria

Have you cracked the code @Lydia_Song?

Not yet :frowning: :frowning: