Health Bar Disappearing Upon Damage

Man, I feel stupid asking all of these questions, but I guess it's better than getting frustrated for a week straight.
Anyway, I've evented a custom battle system which seems to be working just fine, for the most part. The only issue I'm having is that whenever either the player or the enemy take damage, the health bar picture completely vanishes.

Spoiler: Player Health
1623796828586.png
Spoiler: Enemy Health
1623796882700.png

These are both in a parallel process event by themselves.

Then, I have the actual battle system.
1623796967884.png

1623796997411.png

1623797033956.png


I've used this method of displaying health many times, so it's kind of throwing me off. It's probably something simple, but I'm no good at battle systems, so I'm failing to see it.
Are you aware that the "zoom x" of your picture is currently based on the health? Could that be related?
Yes, I am aware. That's how it decreases based on your health.
What's in variables 27 and 30? Are they fairly low numbers? Does the issue only happen when they're fairly low numbers, or also when the numbers are high?

Everything you have there in that calculation is an integer. If it's less than 10 for player health, or less than 30 for enemy health, the /10 and /30 will result in 0 because it truncates any decimals. This would make your zoom 0. If you think this might be the cause, try this instead:

($game_variables[30] / 10.0 * 100).to_i ... use floating point calculation and convert to integer at the end

or

$game_variables[30] * 100 / 10 ... multiply first to ensure it doesn't truncate to 0


If you don't think that's it, or it doesn't make any difference, you might have to turn on the console and output the result of that just prior to changing the picture, so you can track what it's actually doing.

(and stop feeling stupid asking questions - this one is a really good one and I'm very interested to know what the answer is)
OK, so the first thing you suggested actually worked. I'm thinking you were right that it was because the numbers were too low. Normally for health bars, I use the player's health, but I wanted the health to be a bit lower than usual because it's six-sided dice, so the player's health was 10 and the enemy's health was 30 (it's a boss).

Original thread: https://forums.rpgmakerweb.com/threads/health-bar-disappearing-upon-damage.137507/