End Loop when Health = 0?

Hey guys. I am relatively new to RPG Maker (I've had it for a while, but have only been using it for a couple of weeks) and I came to these forums for the first time with a question.

So, for my Japanese class, we have a project where we have to make a game based off of the kanji we have learned. Most people are making "Kanji Go Fish" and things like that, but I decided to take it a step up and make "Kanji: The JRPG."

Basically, it's really short with just a few bosses. Instead of combat, the boss will ask a question (i.e. "what is ___ kanji mean?"), and the player selects from 4 different choices on what the correct answer is. Get it incorrect, and you lose 1/3 of your health. Get it correct, and the boss loses 1/3 of his health. Each boss cycles between 3 questions (set on a loop). This all takes place within a battle event.

My question is: How do you end the loop when either the player or the boss's health reaches 0? The damage is dealt the way it should me when I run it in battle test, but the loop doesn't end when health reaches zero. How do I break the loop when health is 0 and give the player a game over screen (or end the battle with a victory)?
If HP reaches 0 in battle, it should be game over automatically.  If an enemy's HP reaches 0 in battle, the battle will end and you'll be back on the map.


If this isn't what's happening, you've got something very weird happening in your battle, and should probably show us screenshots.
Actually there could be something strange going and it depends on how you're going to subtract hp. I mean, if you inflict mhp/3 damage to wither the player or the boss, this will inflict damage as an integer and will automatically remove any decimal. Ofc iy your player/boss health is not a multiple of 3 you will have 1 or 2 hp left after doing this 3 times.


If this is your case just let it inflict (mhp/3 + 1) damage instead of mhp/3. This should do the trick in that case.


As I said it is not sure that this will fix your problem but if you're working with integers things like this can happen.

Original thread: https://forums.rpgmakerweb.com/threads/end-loop-when-health-0.72417/