# Help about level- medical attention

**URL:** <https://discourse.codecombat.com/t/help-about-level-medical-attention/3287>\
**Category:** Uncategorized\
**Created:** [March 30, 2015, 4:08am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287 "2015-03-30T04:08:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugot1](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bugot1](https://discourse.codecombat.com/u/bugot1)\
**Post date:** [March 30, 2015, 4:08am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/1 "2015-03-30T04:08:29Z")

</div>

what the problem with my code?

```
# Ask the healer for help when you're under one-third health.
loop:
    currentHealth = self.health
    healingThreshold = self.maxHealth / 3
    # If your current health is less than the threshold,
    # move to the healing point and say, "heal me".
    # Otherwise, attack. You'll need to fight hard!
    if currentHealth < healingThreshold :
        self.moveXY(64, 45)
        self.say("heal me")
    else :
        shaman1 = self.findNearest(self.findByType("shaman"))
        if shaman1 :
            self.attack(shaman1)
        else :
            enemy = self.findNearest(self.findEnemies())
            if enemy:
                if self.isReady("cleave") and self.distanceTo(enemy) <5:
                    self.cleave(enemy)
                else :
                    if self.isReady("bash") :
                        self.bash(enemy)
                    else :
                        self.attack(enemy)
```

---

<div class="post-metadata">

**Author:** ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)\
**Post date:** [March 30, 2015, 4:24am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/2 "2015-03-30T04:24:24Z")

</div>

(thank you for what I assume is proper formatting of the code!!)

What error do you get? or outcome? Just saying “what is wrong” makes a lot of work for the rest of us. Any help you can provide makes it more likely that some will take the time to figure it out.

(just so you know, I will continue to edit this until I’m done or someone else posts)

Picky things:  
you should set “healingThreshold” outside the loop, since it won’t change.

---

<div class="post-metadata">

**Author:** ![bugot1](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bugot1](https://discourse.codecombat.com/u/bugot1)\
**Post date:** [March 30, 2015, 4:29am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/3 "2015-03-30T04:29:59Z")

</div>

first, i have a loop and second it just that my hero dosent complete the quest

---

<div class="post-metadata">

**Author:** ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)\
**Post date:** [March 30, 2015, 4:31am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/4 "2015-03-30T04:31:44Z")

</div>

Sorry, I didn’t scroll back up enough, to see it.

Do you not complete because you die, or because the healer dies or …

---

<div class="post-metadata">

**Author:** ![bugot1](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bugot1](https://discourse.codecombat.com/u/bugot1)\
**Post date:** [March 30, 2015, 4:33am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/5 "2015-03-30T04:33:31Z")

</div>

one of the humens dies

---

<div class="post-metadata">

**Author:** ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)\
**Post date:** [March 30, 2015, 4:45am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/6 "2015-03-30T04:45:05Z")

</div>

I could have sworn there was a post where we talk about this level (actually there are several, but I can’t find the one I had in mind) . . . anyway.

In that post I can’t find I think we talked about tryng to keep your hero close to the healer (but not to close) to provide support for your guys as they run for a heal and to head of any sneak attacks from “behind” as it were.

Might this idea be helpful? (move hero closer to village when no enemies)

[Found it](http://discourse.codecombat.com/t/medical-attention-help/3081)

---

<div class="post-metadata">

**Author:** ![bugot1](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bugot1](https://discourse.codecombat.com/u/bugot1)\
**Post date:** [March 30, 2015, 5:21am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/7 "2015-03-30T05:21:45Z")

</div>

still someone dies ???

---

<div class="post-metadata">

**Author:** ![Vlevo](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/vlevo/32/2074_2.png) [@Vlevo](https://discourse.codecombat.com/u/Vlevo)\
**Post date:** [March 30, 2015, 6:13am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/8 "2015-03-30T06:13:45Z")

</div>

(sorry, got distracted)

How many hp do you have at full health?

I just loaded up your code from above and it works fine for me.  
So maybe you need a different seed, try submitting to see if that helps.

HA, I resubmitted and got a different seed and now I am dieing, but not the soldier humans. (it says: “Humans must survive. (3/4)” when I die.)

---

<div class="post-metadata">

**Author:** ![matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@matt](https://discourse.codecombat.com/u/matt)\
**Post date:** [March 30, 2015, 9:09am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/9 "2015-03-30T09:09:17Z")

</div>

I tried out your code and hit the same thing when I submitted. However I then chopped out the bit that goes after shamens first, and that did then seem to work (although its possible other minor differences could have done it). Could try that?

---

<div class="post-metadata">

**Author:** ![bmmtstb](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bmmtstb/32/12265_2.png) [@bmmtstb](https://discourse.codecombat.com/u/bmmtstb)\
**Post date:** [March 30, 2015, 9:20am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/10 "2015-03-30T09:20:14Z")

</div>

try to use a sword with higher attack range, that worked for me. Because u do not have to run as far -\> enemies are faster killed

---

<div class="post-metadata">

**Author:** ![bugot1](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@bugot1](https://discourse.codecombat.com/u/bugot1)\
**Post date:** [March 30, 2015, 7:21pm UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/11 "2015-03-30T19:21:03Z")

</div>

i have 700 health…

---

<div class="post-metadata">

**Author:** ![PixelAA](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@PixelAA](https://discourse.codecombat.com/u/PixelAA)\
**Post date:** [April 6, 2015, 8:21am UTC](https://discourse.codecombat.com/t/help-about-level-medical-attention/3287/12 "2015-04-06T08:21:20Z")

</div>

When I switched from my ranger (Senick Steelclaw) who couldn’t kill the enemies yet fast enough so all humans survived, to my warrior upgrade (Hattori Hanzō) using his special skill “warcry” made a big improvement since I and all allies could run back into and out of action faster.
