# Bank raid help me!

**URL:** <https://discourse.codecombat.com/t/bank-raid-help-me/18973>\
**Category:** Level Help\
**Created:** [August 9, 2019, 3:53am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973 "2019-08-09T03:53:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [August 9, 2019, 3:53am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/1 "2019-08-09T03:53:14Z")

</div>

I need help!

After my hero is done collecting coins at first, it defeats its second enemies, it stops. Here is my code:

```python
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 = coinIndex
        # Collect that coin.
        item = hero.findNearestItem()
        hero.moveXY(item.pos.x, item.pos.y)
        # Increase coinIndex by one.
        coinIndex += 1

```

Please help! 😃

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [August 9, 2019, 11:19am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/2 "2019-08-09T11:19:31Z")

</div>

Hi! Can you provide direct level link, please?

---

<div class="post-metadata">

**Author:** ![brooksy125](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/brooksy125/32/9966_2.png) [@brooksy125](https://discourse.codecombat.com/u/brooksy125)\
**Post date:** [August 9, 2019, 7:29pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/3 "2019-08-09T19:29:19Z")

</div>

A few details to clean up, although this didn’t directly impact the problem. What hero and gear do you have? I found that the Ring of Thorns can cause some problems on this level.

To use the index for the array it should be: variable = array[index]

```python
    while coinIndex < len(coins):
        # Get a coin from the coins array using coinIndex
        coin = coinIndex # look at how it was done with enemy

```

Then use that variable for the move command instead of creating a new variable.

[https://codecombat.com/play/level/bank-raid](https://codecombat.com/play/level/bank-raid)?

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [August 22, 2019, 8:44pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/4 "2019-08-22T20:44:42Z")

</div>

![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/5/56e85fbe08ca4fb019f95063df88f8d68c2e7877.png)

This is my stuff.

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [August 22, 2019, 9:39pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/5 "2019-08-22T21:39:39Z")

</div>

I did it! thanks for the help

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [August 22, 2019, 9:46pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/6 "2019-08-22T21:46:19Z")

</div>

Nevermind, it stopped working

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [August 23, 2019, 7:56am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/7 "2019-08-23T07:56:11Z")

</div>

First do what Brooksy said, but even then it still doesn’t work sometimes and the hero just says “But it’s dead!”. To solve this simply put: `if enemy.health > 0:` before you attack the enemy to make sure it’s still alive.  
-Danny

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [September 22, 2019, 9:26pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/8 "2019-09-22T21:26:01Z")

</div>

When I do that it just shows the X.

---

<div class="post-metadata">

**Author:** ![Xuan](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xuan/32/10545_2.png) [@Xuan](https://discourse.codecombat.com/u/Xuan)\
**Post date:** [September 22, 2019, 9:32pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/9 "2019-09-22T21:32:40Z")

</div>

It worked! I finally finished bank raid. Thanks for the help.

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 16, 2020, 1:31am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/10 "2020-05-16T01:31:08Z")

</div>

Hello I’m new to this.

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 16, 2020, 3:37pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/11 "2020-05-16T15:37:10Z")

</div>

Hi @EpicCoder999, welcome to the CodeCombat discourse! 🎉  
If you need help with your code please post it, formatted as explained here:

> [@\[Essentials\] How To Post/Format Your Code Correctly](https://discourse.codecombat.com/t/essentials-how-to-post-format-your-code-correctly/15521):
>
> Formatting your code before posting code is essential to our community, and if you don’t we might not be able to help frowning Everyone must know how to format ALL of your code properly. It’s really easy and only requires a very small amount of effort. To post your code from the game , use the \</\> button or it won’t format properly. When you click the \</\> button, the following will appear: Please paste ALL …

Thanks  
Danny

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 17, 2020, 12:53am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/12 "2020-05-17T00:53:05Z")

</div>

Can someone buff the level 66 items please? The Crypt Key costs 3100 gems and only have the power of the precious. The boots of flying costs about 500 moregems than boots of leaping and only increases speed by 0.5m/s, the Amber sense stone sux and I have to buy it to play this level I think. The hammers are only the strength of the stone hammer.

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 17, 2020, 12:55am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/13 "2020-05-17T00:55:17Z")

</div>

Oh yes, here’s my code:

```python
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[coinIndex]
        # Collect that coin.
        hero.moveXY(coin.pos.x, coin.pos.y)
        # Increase coinIndex by one.
        coinindex += 1

```

my hero can’t collect coins after it collects the first one!

---

<div class="post-metadata">

**Author:** ![jka2706](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/jka2706/32/13636_2.png) [@jka2706](https://discourse.codecombat.com/u/jka2706)\
**Post date:** [May 17, 2020, 8:37am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/14 "2020-05-17T08:37:51Z")

</div>

```python
        # Increase coinIndex by one.
        coinindex += 1

```

Hi,  
I’m new to this as well :).  
Try using a capital I in coinIndex.

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 17, 2020, 12:26pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/15 "2020-05-17T12:26:13Z")

</div>

Hi @jka2706, welcome to the CodeCombat Discourse! 🎉  
Good spot.  
Danny

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 17, 2020, 2:09pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/16 "2020-05-17T14:09:45Z")

</div>

> [@EpicCoder999](#):
>
> The boots of flying costs about 500 moregems than boots of leaping and only increases speed by 0.5m/s

But you get to fly. 😉  
In case you didn’t know level 66 items are still in development, that’s why their abilities are a little bit unbalanced.  
Danny

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 17, 2020, 3:35pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/17 "2020-05-17T15:35:14Z")

</div>

Yay it worked thx i mean the code (20 chars so annoying)

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 17, 2020, 3:36pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/18 "2020-05-17T15:36:05Z")

</div>

oh might be a glitch cause it says im required to use them.

OMG the morning’s edge only have 80 dps, it should be unlocked at level 15. nvm i will get sword of the forgotten instead, teample guard way too expenise

---

<div class="post-metadata">

**Author:** ![EpicCoder999](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/epiccoder999/32/12768_2.png) [@EpicCoder999](https://discourse.codecombat.com/u/EpicCoder999)\
**Post date:** [May 17, 2020, 6:55pm UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/19 "2020-05-17T18:55:18Z")

</div>

@nick can you reset my gems please? my username is ProGamer247, if the reset deletes the heros i got when im a subscriber, then dont reset cuz i got okar and omarn

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [May 18, 2020, 10:18am UTC](https://discourse.codecombat.com/t/bank-raid-help-me/18973/20 "2020-05-18T10:18:42Z")

</div>

Why do you want nick to reset your gems?  
He probably won’t see this post for a while, so there’s not much point asking him.  
Danny

[Next page](https://discourse.codecombat.com/t/bank-raid-help-me/18973.md?page=2)
