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,624
Reaction score
5,107
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 Profile Posts

Avery's Advent Calendar Day event has put me in a jolly mood, so I dug through my folders finished up some old generator pieces. Check my Fantasy Generator Expansion -Dwarfs! To see what I dropped.
Anyone else here think that closets are claustrophobic?
People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D

Forum statistics

Threads
105,872
Messages
1,017,124
Members
137,593
Latest member
narwhalkyrie
Top