Help about level- medical attention


#1

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)

#2

(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.


#3

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


#4

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

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


#5

one of the humens dies


#6

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


#7

still someone dies ???


#8

(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.)


#9

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?


#10

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


#11

i have 700 health…


#12

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.