Help with a sacrifice skill

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
65
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hello,

I'm back with another mystery to solve. Actually, there is no issue with the game's functionality, but rather the display. I am creating an attack skill that sacrifices 10% of the user's mhp if they are under a condition. Here is what I have.


<Post-Damage Eval>
if (user.isStateAffected(25)){
user.gainHp(-user.mhp*0.10)
}
</Post-Damage Eval>

<target action>
perform start
wait for movement
motion attack: user
wait: 10
action animation
wait for animation
action effect
wait for animation
wait for movement
wait: 5
Add State 25: user
</target action>

It actually functions perfectly, the problem is the damage popup has a freakout and shoots out this infinitely long string of numbers. I tried disabling my damage popup plugin, but the classic display was the exact same way, so I know it's not that plugin. The problem DOES NOT happen if I change user.gainHp(-user.mhp*0.10) to user.gainHp(-1000) for example, it only happens when I use the -user.mhp*0.10) bit. I've also tried -0.10*user.mhp thinking that maybe the formula didn't like starting with letters.

I'd like the damage popup to reflect the true damage being taken, or to disappear altogether (I'd prefer the latter). Can anyone help me with this?
 

Attachments

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,546
Reaction score
5,004
First Language
English
Primarily Uses
RMVXA
My guess is that it happens because of rounding error. Try:
user.gainHp(Math.round(-user.mhp*0.10))
 

Archlvt

Veteran
Veteran
Joined
Mar 8, 2019
Messages
65
Reaction score
5
First Language
English
Primarily Uses
RMMV
My guess is that it happens because of rounding error. Try:
user.gainHp(Math.round(-user.mhp*0.10))
Dammit. That was a good guess. It was simultaneously very simple coupled with the fact that I never would have thought to do that myself since I don't actually know js, I just play with it. I never would have thought to look for that as a solution. Didn't even know math.round was a thing.

Thanks very much. Getting this to work wasn't just for this skill, but it was a domino effect to making my entire class function.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

My pumpkin! Anyone like Fallout?

It's not terrible, but could be better. This thing took me over an hour to carve. :kaophew:

Dad's watching a WWII documentary while I work on some cool assets for my games. I just love RPG Maker!
Also Happy Halloween! Dad's friend won't be coming unfortunately, but Dad will still be taking me to Boxi Park to have some fun tonight! I'll be posting a video on my YouTube channel of the show, and I'll be sure to post a link here.
"Nightmares exist outside of logic and there's little fun to be had in explanations. They're antithetical to the poetry of fear. In a horror story the victim keeps asking why, but there can be no explanation and there shouldn't be one..." - Stephen King
I feel people seek explanation and demand it sometimes in games, but in the horror genre, well, maybe you shouldn't have one. Silent Hill 1 comes to mind...
Managed to implement QSprite.

Always double check your plugin order.


Finally! I've been puzzling over why it wasn't working for two days now. Turns out all of my calculations were correct, I just forgot to give some events hitboxes. :kaoswt: Now my randomly generated maps check for collision errors, and move stuff around in real time if they finds any. :LZSexcite:

Forum statistics

Threads
104,682
Messages
1,008,071
Members
136,172
Latest member
Zykon
Top