Health Bar Disappearing Upon Damage

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,993
Reaction score
3,639
First Language
English
Primarily Uses
RMVXA
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.

1623796828586.png
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.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,713
Reaction score
2,830
First Language
English
Primarily Uses
RMMZ
Are you aware that the "zoom x" of your picture is currently based on the health? Could that be related?
 

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,993
Reaction score
3,639
First Language
English
Primarily Uses
RMVXA
Yes, I am aware. That's how it decreases based on your health.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,909
Reaction score
15,000
First Language
English
Primarily Uses
RMMV
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)
 

HexMozart88

The Master of Random Garbage
Veteran
Joined
May 15, 2016
Messages
1,993
Reaction score
3,639
First Language
English
Primarily Uses
RMVXA
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).
 

Latest Threads

Latest Posts

Latest Profile Posts

It's really not fun burning 4 hours looking at code and trying certain things and getting no where.
:kaoswt2: Steam seems down again... oh nevermind, it's up now
After so long, my random sprites set is complete! I wonder who could guess them all? :kaothx:
2COlHup.png

And yes, I'm doing more.
I'm thinking of devouring some tutorials for RPG Maker MV. Just all kinds: mapping, spriting, programming, ect. the whole works! :)

Maybe videos, my brother and I can sit down and watch them during one of our weekly business meetings.

Forum statistics

Threads
113,931
Messages
1,078,480
Members
148,036
Latest member
Dovelia
Top