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