Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[Solved] Mission Medical Attention Python

#1

while True:
    enemy = hero.findNearestEnemy()
    
    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 currentHealth < healingThreshold:
        hero.moveXY(65, 46)
        hero.say("heal me")
    else:
        hero.attack(enemy)

I finished the mission because my health is a lot and the standard guys hold out pretty good. But when i skip a few seconds i noticed that the guy does go back for the heal like it should. But he doesn’t attack?

#2

never mind guys, fixed it with this code:

Mod edit: [Please don’t post successful solutions.]