[SOLVED] RPG MAKER MV : HP cost skill customization issue

Status
Not open for further replies.

PLUEVNR

Warper
Member
Joined
Jan 15, 2020
Messages
4
Reaction score
1
First Language
French
Primarily Uses
RMMV
Hello,

I'm doing a skill dealing damages depending on current HP
I'm using YEP_SkillCore

This is my Skill damage formula and customization added

dmg :
Code:
a.hp+a.atk*3
custom :
Code:
<Custom Requirement>
   if (user.hp > 1) {
     value = true;
   } else {
     value = false;
   }
</Custom Requirement>

<Custom HP Cost>
      cost+= user.hp - 1
</Custom HP Cost>

My skill is working well, it's taking my current HP to deal the damage BUT instead of dealing the damages then losing the HP, it's losing the HP then dealing the damages

if i'm not clear enough :
if i have 200hp left, it should do 199 + atk *3

but since it's losing the HP before the damage calculation, it's doing : 1 + atk*3

any idea on how i could solve this please?

thx :)
 
Last edited:

Sword_of_Dusk

Keyblade Master
Veteran
Joined
Sep 13, 2015
Messages
64
Reaction score
19
First Language
English
Primarily Uses
RMMV
Fairly certain it's because you're using the damage formula box. When I sought out help to make a skill that converted remaining TP into MP, I was instructed to use Yanfly's Damage Core to set up a custom formula, rather than setting up my formula through the formula box.

It has to do with the order the box will utilize, I think. It'll always apply the skill cost before the actual formula comes into play.
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,014
Reaction score
946
First Language
English
Primarily Uses
RMMV
Try this. No guarantee, but it should work in theory:

Code:
<Custom HP Cost>
  user._hpSnapshot = user.hp;
  cost += user.hp - 1
</Custom HP Cost>

<After Eval>
  delete user._hpSnapshot;
</After Eval>
Then, change your damage formula to:

Code:
(a._hpSnapshot || 0) + a.atk * 3
 

PLUEVNR

Warper
Member
Joined
Jan 15, 2020
Messages
4
Reaction score
1
First Language
French
Primarily Uses
RMMV
Fairly certain it's because you're using the damage formula box. When I sought out help to make a skill that converted remaining TP into MP, I was instructed to use Yanfly's Damage Core to set up a custom formula, rather than setting up my formula through the formula box.

It has to do with the order the box will utilize, I think. It'll always apply the skill cost before the actual formula comes into play.
I forgot about that, I'll keep that in mind for other skills, thanks :)


Try this. No guarantee, but it should work in theory:

Code:
<Custom HP Cost>
  user._hpSnapshot = user.hp;
  cost += user.hp - 1
</Custom HP Cost>

<After Eval>
  delete user._hpSnapshot;
</After Eval>
Then, change your damage formula to:

Code:
(a._hpSnapshot || 0) + a.atk * 3
Works perfectly, thanks a lot !


Thread can be closed.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,050
Reaction score
4,261
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Who loves the Final Fantasy series?~
Weather and time system twin release. Now with weather icons and possibility to add them in your custom clock!
Kingdom Under Fire: The Crusaders is finally being ported to PC. I loved playing that game on the original Xbox.
A friend told me to stop making nomnom or gulping noise when eating or drinking. Plot twist of my life. I thought people can't hear that!

Forum statistics

Threads
94,411
Messages
920,758
Members
124,207
Latest member
AshleyBrowney
Top