This is a post about how to turn your MP into temporary HP. (Dealing damage to your MP instead of your HP.)
(Yanfly has a semi similar effect, but with differences, and wasnt able to achieve this effect. It worked more like FFTA Blue Mage, or other games, where a portion of dmg is dealt to MP.) In this version, damage will go to MP, but if the damage is larger than the MP amount left, the remainder goes to your HP.
EX: HP 1,000MP 100
The player is attacked for 500 dmg.
the MP removes 100 dmg, leaving 400 to go through to the HP. (100 MP is lost, just like HP is lost from damage) HP 600MP 0
To set this up, you will need to create a "State". This state can be named "Damage MP" or "MP Shield", which ever you want.
As long as the player has this state, all damage they take will be directed to MP 1st, before HP.
In order to make sure all damage dealt does this, you need to adjust the damage formula of every HP attack. The formula is c=b.mp; d=a.atk*4-b.def*2-c; e=0; if (!b.isStateAffected(id)) e=c; elseb.gainMp(-a.atk*4-b.def*2); d+e
first you establish what the targets current mp is. then you make a formula which takes the targets mp into consideration.
after that, you check to see if the target does NOT have the buff (-edited out this part-) if the target is normal, the e will become the same as the target mp, otherwise the else statement triggers due to the buff.
The else statement 1st uses the "gain MP" but negatively, so they lose MP. This is the only way to both take MP and HP damage at the same time. It is also followed by the formula we established earlier, since the MP has been removed/damaged, we dont want it to effect the dmg being dealt to the HP. Then it will add extra damage based on what e is. If they didnt have the buff, it adds the missing dmg. if they did have the buff, it adds no dmg.
This does not account for HP drain effects. Only the HP damage is drained, and the MP dmg is not drained. MP drain effects also wont trigger, and if u adjusted it to trigger, they only drain the MP based on how much MP the target had left, and not the damage you dealt.
You need to place this in the damage formula of every HP damaging attack.
Hope this helps those looking to have a sort of Damage MP option in their game!