HP damage due to lack of MP

Thank you very much for checking about my request,
I am very grateful.


HP damage due to lack of MP


Description:

For example, imagine a SKILL costs 50 MP (in the game I am making, it will be called STAMINA, but no worries about it), but the character has only 30 MP available.
then...
...the skill is performed anyways...
Yes, 50 of cost with 30 MP and the skill is still performed.

However... this "20" that was left will be cost from the user's HP. The character, then, will end up with 0 MP, of course.

If right after he decides to use the same skill, 50 HP entirely will costs him, since he will be at 0 MP.

MP begins every fight in zero (already "evented" this part), and then it recharges automatically, like any other STAMINA from a STAMINA system.

When the 0 MP recharges for, as an example, 5, and the technique is used again, then this 5 MP will be cost and 45 HP will be cost... after this, the MP will start to recover again from 0 and the HP won't, of course, only if recovered manually by the player through magics or items (MP recover by turns, I have made it by events).

If the skill is still so powerfull that it costs even more than the character's MP and HP together, the skill can still be used by that same character, but he dies just after, since MP and HP will both jump to 0 after the skill is performed.

So, the thing I was unable to event is getting HP damage serving as MP when the character lacks MP, even if it kills him. A plugin able to do it is my request, thank you for reading until here ^^.

More strategy, hard choices about using something or not and even sacrificing characters as strategy (to damage enemies or for magics for the sake of others) will be added to the gameplay of the game.

Also, I've made the GUARD command almost unbeatable, so it can be used for characters to spend some turns recovering MP during a fight as time passes (almost... not totally, of course).

The logic I though is in stamina itself on the body... stamina is the body's resistance, so, when your stamina is lacking and you STILL do something (like running a lot and still run a lot even after you get really tired, like I did once), your body will have complications.
This is something equal as HP damage due to lack of stamina available in you, the solution is to train pacientally to go futher in your stamina.


History:

Spoiler: History
I though about it when I played Final Fantasy 4 for the first time.

There, the mage TELLAH uses the great magic METEOR on the villain GOLBEZ, but he end up dead right after.

He was still too weak to use such a powerfull magic, he himself told everyone about it during the game... but... JUST because it was storytelling time he was able to use meteor without the proper MP, but with the proper consequences... the game would never allow it on actual gameplay.

Here the moment:



Other fighting plugins I am using at the moment:


Thank you very much for the attention given ^^.
I appreciate it by a lot.
You'll need a somewhat complicated damage formula to start.
First, you'll have to set the MP cost to 0 in order for it to be usable no matter how much mp the user has.
then you'll need a formula similar to this one:

cost = 50; recoil = 0; if (cost > a.mp) recoil = cost - a.mp; if (recoil != 0) a.gainHp(-recoil); a.mp -= cost; form

You can copy/paste this into your skill and only change the form part at the end to reflect your original damage formula
and it should work fine.

Now, to make it APPEAR to take 50mp when you set it to 0, you'll need a plugin to change the value shown to the player or just put it in the skills description. (I know you would rather not do that.)
Yanfly's Skill Core MIGHT do that, but I don't know.
I'ma assume it doesn't and see if I can throw something together to help.

EDIT: Nevermind most of the above.
I made a plugin snippet to help with this:


Just insert the tag <bypassCost> in any skill you want to have this feature and it will ignore skill cost.

You will still need to use the damage formula to damage the user when they don't have enough to use a skill, but now you don't have to set the skill at 0.
Also, setting the cost value will be a bit tricky IF you have any cost reduction/expansion in your game.

Code:
cost = 50; recoil = 0; if (cost > a.mp) recoil = cost - a.mp; if (recoil != 0) a.gainHp(-recoil); form
Thank you very much, it worked the exact way I imagine it to work. ^^
I don't know what can I do in order to thank you enough.

I got only one issue about the formula... it seems that the RPG Maker were adding the 50 MP cost put for the skill into the 50 MP cost of the formula (I started a new project without other plugins in order to test).
During a fight, in the HUD, only 50 had been taken from the user's MP... but the game was interpreting the cost as 100 (40 MP left, acording to the HUD, but 10 HP of recoil... and when the MP was in 0, 100 HP of recoil if used again... when I put 30 MP of use, and, in the formula, cost = 20, the game had taken 50 HP from the character).
However, since it was adding one to the other, I just changed the "cost = 50" to "cost = 0" in the formula and everything worked fine.

Again, thank you very much for your assistance and for the plugin.
Copy and paste your formula here so I can check what might be happening.

Original thread: https://forums.rpgmakerweb.com/threads/hp-damage-due-to-lack-of-mp.108571/