Me need help on bank raid

# Wait for ogres, defeat them and collect gold.

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

1 Like

dis me code

1 Like

how about you add an if-statement:

if enemy:
    hero.attack(enemy)

and for the coin:

if coin:
    hero.moveXY(item.pos.x, item.pos.y)

PS. Welcome back!

2 Likes

That should work. But it also depends on the gear as well. So, could we see your gear please?

nope doesnt work sadly oof

okay
ima take a quick screenshot

it told me to use the cleaver

have you ever tried using cleave?

2 Likes

I would also implement bashing and shielding(optional) to increase your survivability rate.

nah not the shield i dont wanna use it


i just made new code and it doesnt work

Instead of using len use this:

if coin and not enemy:
    hero.movexy(coin.pos.x, coin.pos.y)

Because you can focus on attacking, and still pick up coins
Ring of speed also helps a LOT

you forgot to capitalize the x and y in the moveXY

Yeah. Sorry about that