Help in reward and ruination

i have a problem in reward and ruination.all is good , but , the third time my artillery stop shooting.here is my code:

while True:
    enemy = self.findNearest(self.findEnemies())
    if enemy:
        enemyPos = enemy.pos.x + " " + enemy.pos.y
        self.say("Enemy at " + enemyPos)
gem = self.findNearest(self.findItems())
    if gem:
        gemPos = gem.pos.x + " " + gem.pos.y
        self.say("Gem at " + gemPos)

all help will be appreciate.

Could it be the indentation of the gem = line?
You’ll want that line to be part of the code block inside the while loop, not at the same indentation level.

Thank you very much. But in my level gem = self.findNearest(self.findItems()) was aligned.

…and it is not working.