Is there a way to make a skill heal for half the damage caused?

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
5,009
Reaction score
3,180
First Language
English
Primarily Uses
RMMV
One curious thing I've noticed is it seems to factor in decimals as well, which is something I haven't seen before in any of my previous formulas.
If you want to avoid that, put your formulae inside of Math.floor() any time you divide a number (or multiply by a decimal, same thing). That will round down the number.

You can see how I and Anastasius did that in our solutions we posted for you.
 

Arthran

Veteran
Veteran
Joined
Jun 25, 2021
Messages
515
Reaction score
496
First Language
English
Primarily Uses
RMMZ
Oopsie, I *did* forget Math.floor. If you wanna get rid of the decimal, you can keep your damage formula the same. Just change the script that's in the common event to this:

JavaScript:
$gameVariables.value(1206).gainHp(Math.floor(($gameVariables.value(1207) - $gameVariables.value(1208).hp) / 2));
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
675
Reaction score
78
First Language
English
Primarily Uses
If you want to avoid that, put your formulae inside of Math.floor() any time you divide a number (or multiply by a decimal, same thing). That will round down the number.

You can see how I and Anastasius did that in our solutions we posted for you.

Oopsie, I *did* forget Math.floor. If you wanna get rid of the decimal, you can keep your damage formula the same. Just change the script that's in the common event to this:

JavaScript:
$gameVariables.value(1206).gainHp(Math.floor(($gameVariables.value(1207) - $gameVariables.value(1208).hp) / 2));

Thank you, that fixed it.

I didn't really mind the decimals, but I guess I should probably change it so it's more consistent with all my other skills. Thanks again for all the help. ^^
 

Latest Threads

Latest Profile Posts

I finally finished the Coliseum for my game. Love how it looks. Credits for the assets goes to Kokoro Reflections, @Starbird_Resources, and @megumi014.
Colossuem.png
Mimics! Mimics everywhere!
Pirate portrait quickie :LZYcheeze:
pirate.png
My game has a (much needed) tutorial now...
Game Making Every Day #20:kaohi:

Forum statistics

Threads
124,511
Messages
1,164,157
Members
163,346
Latest member
LightTenko
Top