Ability that Restores MP based on how much TP is used

Hi! I'm in the process of balancing my mage character by having small dry periods that are filled in by restoring mana with an ability that consumes TP.


High amounts of TP are gained from using spells, and the TP goes towards a self target spell that restores mana.


I've been attempting to think of ways to balance self restoring mana without the use of too many plugins. But unfortunately, on its own. The TP system has too many variables


to allow consistent mana regeneration. Especially in between random encounters since TP is set low at the beginning of a new encounter.


I figured the best way to work around this would be to make the mana restore ability to restore a base percentage, plus all of your TP that you had at the time of casting.


Example:


Character has 2/50 MP and 25TP


Fireball costs 15MP


Restore Mana has variable TP cost based on current TP. So for this turn, it would cost 25TP


Using Restore Mana at this point would restore 5% of Mana, and consume the 25TP to restore an additional 25MP


And in the same example, if you had 40TP and used the ability. Using Restore Mana would recover 5% of your Mana, and consume the 40TP for an additional flat 40 mana.


Is there either a script/common event/ or a plugin that could make this ability possible?
This seems more like a script request for a specific project than a general discussion of the mechanics, so this is probably not the right area to post this request.


Were there any questions you had about the use of TP and Mana in general? It sounds like you have the ideas you want worked out already and are just asking for the execution, so I'm not sure how much there is to actually talk about mechanics-wise.
Oh my bad, I suppose this isn't the board for this then?


And no thank you. I understand how the functions of TP work, and I know that there are plugins that can help affect the rate at which TP is gained and how much stays or decays after battle. So I'll just try and relocate this question.
I've moved this thread to JS Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.
I've moved this thread to JS Plugin Requests. Please be sure to post your threads in the correct forum next time. Thank you.

???


Oh just read the 2 other posts, you didn't read the question and went straight ahead moving the thread.


For your question, it is easily doable using Yanfly Skill Core


<After Eval>


user.gainMp((user.mmp * 0.05) + user.tp)


user.setTp(0)


<After Eval>


No TP cost, just make it that you can't do it below a certain amount of TP


<Custom Requirement>


value = false


if (user.tp > 0) {


value = true; }


</Custom Requirement>


Yanfly TP Core or whatever it is called easily fix your TP in battles problem
Would this be something I'd put into the Notes section of the skill? Or would I make it perform a common event that calls it in?
Yes, those are notes that you put inside the skill.
After making a dummy move to test it out in the Troops battle test, this error shows up whenever attempting to use the ability. Something to do with some plugins that I have in my folder. Could this be an error with the positioning of the plugins on my list? Something outdated? Or did I do something wrong?


The base RPG Maker MP/TP cost sections are set to 0

error.png

Notes.png
Sorry, the last After Eval should be


</After Eval>
Thanks! It works perfectly after that. I noticed that it gives me decimals in the display of mana, is it possibly because of the (user.mmp * 0.05)  portion?


Should I be putting a % sign somewhere in there?


Edit: Also sometimes on top of the decimals. Sometime it does this weird jumble. I'm assuming a setting to turn off display of decimals would stop this from


happening


Untitled.png
user.gainMp((Math.floor(user.mmp * 0.05)) + user.tp)
Thanks! I'll give this a run now. Thanks for all the help!


Edit: Everything is working perfectly! No decimals or jumbled up words! Thank you so much for the help!

Original thread: https://forums.rpgmakerweb.com/threads/ability-that-restores-mp-based-on-how-much-tp-is-used.71500/