Bank Raid Level Not Working (Solved)


This is my code

# Wait for ogres, defeat them and collect gold.

while True:
    enemies = hero.findEnemies()
    # That variable is used to iterate "enemies" array.
    enemyIndex = 0
    # While it less than the array length:
    while enemyIndex < len(enemies):
        # Get an enemy from the array.
        enemy = enemies[enemyIndex]
        # Increase "enemyIndex" by one.
        enemyIndex += 1
    coins = hero.findItems()
    # That variable is used to iterate "coins" array.
    coinIndex = 0
    while coinIndex < len(coins):
        # Get a coin from the "coins" array at coinIndex.
        coin = coins[coinIndex]
        # Collect that coin.
        hero.moveXY(coin.pos.x, coin.pos.y)
        # Increase "coinIndex" by one.
        coinIndex = coinIndex + 1

But for some reason my hero just sits there and doesn’t collet the coins.


Your Code is OK and it works for me.


what glasses are you using?


I have the enchanted lens on


Try resubmitting the code and if that doesn’t work perhaps insert a hero.say() after the coins detection.

coins = hero.findItems()
hero.say("Coins length= " + coins.length)


The code gets stuck on the second loop after it finishes killing the ogres.


It’s solved. apply the level doesn’t work with wizards so I changed my hero into a melee hero and it worked


WHY is it that we need to not use wizards on this level? Codewise I mean. Did I miss something along the way?


It works with wizards, but for them you need another solution than for a warrior.


well right now i had see this same bug.

my solution (in spanish, i translate all text i can to my native language, including comments and variables) was using the warrior :

# Espera por los ogros, derrotales y recoge oro.

while True:
    Enemigos = hero.findEnemies()
    # IndiceDeEnemigos es usado para iterar el arreglo Enemigos
    IndiceDeEnemigos = 0
    # Mientas IndiceDeEnemigos es menor que len(Enemigos)
    while IndiceDeEnemigos < len(Enemigos):
	# Atacar a los enemigos en IndiceDeEnemigos
        Enemigo = Enemigos[IndiceDeEnemigos]
        hero.isReady("cleave") and hero.cleave(Enemigo)
	# Incrementar IndiceDeEnemigos en uno.
        IndiceDeEnemigos += 1
    Monedas = hero.findItems()
    #DILO#hero.say("Monedas= " + Monedas.length)
    # Monedero es usado para iterar el arreglo Monedas
    Monedero = 0
    while Monedero < len(Monedas):
        # Recoge una moneda de las monedas usando el arreglo Monedero
	Moneda = Monedas[Monedero]
	# Recoge esa moneda
        hero.moveXY(Moneda.pos.x, Moneda.pos.y)
	# Incrementa el Monedero en 1
        Monedero += 1

For some strange reason, if i try to use hero.attack instead hero.isReady(“cleave”) and hero.attack(“cleave”)

When the hero defeat the enemies and the coins appears, the warrior, don’t move to pick up coins.

but when i change attack method for cleave, the hero yes pick up the cleave, but i don’t understand why.