[SOLVED]Help with Medical Attention

# Ask the healer for help when you're under one-half health.

while True:
    currentHealth = hero.health
    healingThreshold = hero.maxHealth / 2
    # 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 hero.health < 153:
        hero.moveXY(65, 48)
        hero.say("Heal me")
            enemy = hero.findNearestEnemy()

my hero seems to not want to move and attack enemys any suggestions?

Change that to

if hero.health < healingThreshold:

change that to

enemy = hero.findNearestEnemy()
if enemy:


i just did that and now my hero is not able to moveā€¦

well it was already not wanting to move

Find the nearest enemy and define it as enemy. Then if your health is not below the healing threshold, check if there is an enemy. If there is an enemy, then attack it.

if hero.health < healingThreshold:
    #move and get healed
elif enemy:

Thank you @Eric_Tang & @abc

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.