Premature 'no target' error message in loop (Solved, kinda)


I’m trying to solve Kithgard Mastery with a single loop command.

Edit: I see now that my code won’t actually do much to help here since this map is randomly generated.

Just as my character starts moving, though, it tells me that there’s no target to attack and to fix my code before the loop even gets to the point where he should be attacking, but he attacks the target I specified just fine even with the error still there. Help?

Also, how do I make my character say the amount of gems he has? I just realized he’ll be stuck saying “1” to every fireball trap unless I can make him state the amount he has on his own, which wasn’t taught in any of the previous levels.

I found a helpful tutorial for the gem count, and the premature warning thing didn’t seem to negatively affect the dungeon for me in any way, so it looks like this is resolved. Thanks anyway!