In Sarven Rescue, I set a series of flag commands to control my character. The black flag was supposed to control combat. (See code below) I expected combat loop to continue until the enemy were all defeated. Instead, the character would attack once and then quit. I finessed the level by dropping multiple flags for combat.
Can I create a secondary loop inside the “if enemy:” statement? How do I do it? I tried “while enemy:” but that was an infinite or a very slow loop.
black = self.findFlag("black") if black: self.pickUpFlag(black) enemy = self.findNearestEnemy() if enemy: self.attack(enemy)