Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Medical Attention level


currentHealth =
healingThreshold = self.maxHealth / 2
# If your current health is less than the threshold,
if < healingThreshold:
self.moveXY(85, 46)
self.say(“heal me”)
# move to the healing point and say, “heal me”.
It keeps saying that "Target is null. Is there always an enemy to attack?(Use if)"
Can someone tell me how to fix it? Thanks


To format your code correctly, please highlight it and click the </> button. Reading the FAQ first helps. :wink:

That error message, in my experience, usually means that you should change [quote=“DiamondsGaming, post:1, topic:6145”]
[/quote]to something like this:

enemy = self.findNearestEnemy()
if enemy:

This keeps your hero from trying to attack an enemy that doesn’t exist.