I'm using RPG Maker MV and the HPConsumeSkill plugin by Sasuke KANNAZUKI.
I'm wanting to develop a skill which sacrifices the player's hp in order to perform a super powerful attack, such as "Self Destruct" from the Pokemon games.
The HP Consume plugin uses the following in a skill's notes.
<hp_cost: x>
Is there a way to make x equal either the character's max hp or current hp?
Why not make the skill say no cost in the editor, and in the damage formula use:
a.add_state(1); (insert your damage formula here)
That way it KO's the user, by adding the KO state. Same effect.
Also, if you want to prevent someone from using the skill say when they have say 1 HP, you could set a skill cost via the plug in to whatever your minimum cost is.
I entered the following into the skill's damage field:
a.add_state(1); (a.mhp)
The actor did not die and the skill did zero damage.
Concerned that I misunderstood your post I entered the following:
a.add_state(1); a.mhp
The actor did not die and the skill did zero damage.
First thing, a is the actor or user, so right now the formula would be doing damage to the actor (or user) of the skill only, which is probably not what you intended, and it would be a pretty useless skill. You probably meant b.mhp (a is user, b is target, so a.mhp just tells the actor to KO themselves and nothing more).
As for why zero though, no idea, as it should be doing damage with what you posted, unless you changed state 1. Check the thread how to make the most of custom formulas (I can't copy/paste on this comp, so all I can do is refer you to the thread), it will tell you more on how to add a state in the damage formula, but its probably something like a : is off or something. It's under an ACE thread, but the idea will be the same.
Edit: Try a.addState(1) instead. It looks like MV changed the command to remove the _. If that fails change it to b.addState(1), as someone on another thread said they had to use b for some odd reason? If both fail, Shaz started a thread for damage formula help in MV, someone might be able to figure out what went wrong.
As for the OP about the plug-in, I don't think that was ever set up to be done that way. Yanfly used to have an option to set up a suicide skill (a skill that removed all HP when used), but that is for ACE. Maybe he'll convert over his script to put it in MV soon?
add_state is the ruby code and does not work in MV which uses JS.
I'm not on my computer so cannot check but I think it's addState. However there is a pinned topic on damage formula in the main MV support forum. I suggest you have a quick look there to check what it should be.
I tried the following in damage calculation:
a.addState(1); (a.mhp)
The result was that the enemy was dealt damage equal to the actor's MaxHP, and then knockout state was inflicted upon the actor once the skill was completed.
Thank you guys! I'll check out that pinned topic too. It sounds like a good one. ^_^