# Level: Molotov Medic

**URL:** <https://discourse.codecombat.com/t/level-molotov-medic/203>\
**Category:** Uncategorized\
**Created:** [January 10, 2014, 5:08am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203 "2014-01-10T05:08:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwinranade99](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@ashwinranade99](https://discourse.codecombat.com/u/ashwinranade99)\
**Post date:** [January 10, 2014, 5:08am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/1 "2014-01-10T05:08:13Z")

</div>

I can’t seem to figure out how to beat this level?! In the for-loop, how do you determine how much health any troop has? Thanks for the help!

---

<div class="post-metadata">

**Author:** ![HandmadeMercury](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@HandmadeMercury](https://discourse.codecombat.com/u/HandmadeMercury)\
**Post date:** [January 10, 2014, 5:10pm UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/2 "2014-01-10T17:10:21Z")

</div>

Hello! Each troop has a `health` property, so you just need to append `.health` to the end of their objects to access their health.

For example, to get Tharin’s health, you would use `this.health`, and if you have an object named `friend`, you would use `friend.health`

Keep in mind, though, that this particular level is kind of broken, and might not behave exactly the way you think it will.

---

<div class="post-metadata">

**Author:** ![michael\_bubb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/michael_bubb/32/8761_2.png) [@michael\_bubb](https://discourse.codecombat.com/u/michael_bubb)\
**Post date:** [January 13, 2014, 2:40am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/3 "2014-01-13T02:40:51Z")

</div>

this was a great hint. THis seems to work for me:

var friends = this.getFriends();  
for ( i=1; i \< friends.length; ++i ) {  
var friend = friends[i];  
if(friend.health \< 15 ) {  
this.say("Here, " + [friend.id](http://friend.id) + “!”);  
this.attack(friend);  
}  
}

---

<div class="post-metadata">

**Author:** ![HandmadeMercury](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@HandmadeMercury](https://discourse.codecombat.com/u/HandmadeMercury)\
**Post date:** [January 13, 2014, 4:42am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/4 "2014-01-13T04:42:14Z")

</div>

Good job! That’s pretty similar to my code.

One thing you may want to consider doing is trying to determine who needs the potion the most and then giving the potion to them, instead of always waiting until someone gets below 15

---

<div class="post-metadata">

**Author:** ![michael\_bubb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/michael_bubb/32/8761_2.png) [@michael\_bubb](https://discourse.codecombat.com/u/michael_bubb)\
**Post date:** [January 13, 2014, 12:58pm UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/5 "2014-01-13T12:58:02Z")

</div>

yes - haven’t figured that piece out yet. thanks!

---

<div class="post-metadata">

**Author:** ![Sh4d0W](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@Sh4d0W](https://discourse.codecombat.com/u/Sh4d0W)\
**Post date:** [May 3, 2014, 10:57am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/6 "2014-05-03T10:57:49Z")

</div>

My first code was like this:

```
var friends = this.getFriends();    
for (var i = 0; i < friends.length; i++) {
     if(friends[i].health < 10) {
        this.say("Here, " + friends[i].id + "!");
        this.attack(friends[i]);
     }
}

```

It didnt work so I checked the forums and its pretty much the same as @michael_bubb 's code. But it still doesnt work for me 🙂 I tried to change the health to 15 as michael, but it still didnt work. Is there a better way to do this or the level is just bugged?

//////

---

<div class="post-metadata">

**Author:** ![gosnat](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@gosnat](https://discourse.codecombat.com/u/gosnat)\
**Post date:** [May 3, 2014, 7:45pm UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/7 "2014-05-03T19:45:40Z")

</div>

I had previously beaten that level, and now the code I used (which is basically what you’re using) isn’t working, so I think something must have changed, like the attack speed of the brawler or something.

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/nick/32/784_2.png) [@nick](https://discourse.codecombat.com/u/nick)\
**Post date:** [May 6, 2014, 12:36am UTC](https://discourse.codecombat.com/t/level-molotov-medic/203/8 "2014-05-06T00:36:13Z")

</div>

I did make some tweaks to that level after I noticed that the balance had gotten a bit off. I think in order to beat it now, you’ll have to find the friend with the least health, not just the last one who has `health < 10`.
