Hey there! So what I want should be pretty simple to understand (though not simple to actually do, otherwise I wouldn't be here, lol). Basically, I want a skill that costs in MP however much HP the foe has. For example, if the foe has 999 HP left, it would cost 999 MP to use the skill. If the foe has 224 HP left, it would cost 224 MP to use the skill. (I haven't played FF15 yet, but from what I saw in trailers, it's probably VERY similar to that in effect.)
Is something like this possible? Note that I'm using Yanfly plugins, so I'd prefer a method that uses those, if possible.
Consider that you choose the skill first (and if you don't have enough MP for the skill, it's not available to select), and then you choose the target. So when your skill selection window is open, you have no idea how much MP the skill is going to cost because you haven't reached the part where you select the target.
This is not as easy as you might think it's going to be.
However, Yanfly has a skill cost plugin, and there may be some way in that to handle it.
Not sure if what you want to achieve is achievable...
Here is a hack way of doing it. Put the formula in any skill/item formula box:
if(b.hp <= a.mp) { a.gainMp(-b.hp); b.hp; } else { 0; }
If b (target)'s HP is less than or equal to a (user's) MP, then a (user) loses target's HP and does damage equal to target's HP
If b (target)'s HP is above a (user's) MP, then skill does 0 damage
The issue is if there are multiple targets, then the skill cost would have to change dynamically. To my limited knowledge, there is no easy way to extract the "target's" parameters until you select the target (once you select the target, the target's parameters become "b").
Yeah, you cannot actually do it as is because the skill selection is done before target selection... But well you can maybe modify the selection script so that it computes for the "mp cost" and checks if you have enough, if not it returns you to the skill selection.
The method above should work too but the problem is it means you will only know if the user can use it during damage calculation, if not then it will not deal damage. That can be frustrating to the player