Creating a Skill That Restores 5% MP Relative To Damage Dealt By The Skill

Basically the title lmao. If any of you have played octopath traveller, I want to create a skill that's basically identical to that game's thief's "Steal SP" skill.

I've been using plug-ins and what not, and have the skill looking perfectly right now, all except the MP Draining bit. There is an option with the plug-ins I'm using to have skills steal or restore MP relative to damage hit, but... unfortunately (for some reason) it's exclusive to MP Damaging skills.

I'm assuming there's a way to do this in game or with java script, however. Is there a way I can achieve this MP Restorting effect?
a.gainMp(a.mmp * 0.05); a.atk * 4 - b.def * 2

That should give 5 %MP and do a standard atk, for amount of damage just change up the attack to how you would like. I'm sure somebody here could do a better damage formula that adds some of the damage to that.
a.gainMp(a.mmp * 0.05); a.atk * 4 - b.def * 2

That should give 5 %MP and do a standard atk, for amount of damage just change up the attack to how you would like. I'm sure somebody here could do a better damage formula that adds some of the damage to that.
oh I have the damage formula figured out already, actually. it was the mp/hp restore that was getting me. I'll try this now and see if iit works!
Just make it a standard HP Damage attack and put that in the damage formula. Should work ! Oop just read tha part about damaging the enemies MP I don’t think it’ll do that.
I've been using plug-ins and what not
in the future, you'd want to say what plugins you were using. if Visustella's Battle Core or Turans Eval Tags are within that list, then could use the relevant skill notetag and then use
Code:
user.gainMp(Math.ceil(value/20))
target.gainMp(-Math.ceil(value/20))
to make it so that whatever damage the skill does, the user regains 5% of it and the target loses the same amount (granted, i dont think enemies had SP to begin with, so you probably just want the first line)
Just make it a standard HP Damage attack and put that in the damage formula. Should work ! Oop just read tha part about damaging the enemies MP I don’t think it’ll do that.
ok so this DOES work, but it's kind of wonky.
The SP that gets restored can come out as a fraction, im mostly seeing 3.25 restored with my formula at level 1.

"a.gainMp(a.mmp * 0.05); 1.1 * a.mat * 2 - b.mdf * 0.4625" is what I currently have as my formula, for reference.
in the future, you'd want to say what plugins you were using. if Visustella's Battle Core or Turans Eval Tags are within that list, then could use the relevant skill notetag and then use
Code:
user.gainMp(Math.ceil(value/20))
target.gainMp(-Math.ceil(value/20))
to make it so that whatever damage the skill does, the user regains 5% of it and the target loses the same amount (granted, i dont think enemies had SP to begin with, so you probably just want the first line)
Apologies for that, you're correct that I am indeed usiing Visustella. I was told not to mention them on here or the post would get deleted, so that's why I didn't. I'll be sure to iinclude that info if I need help again.

As for the plugin, they do have a note tag called <Life steal>, but its not what im looking for, for the reasons mentioned above. I just want MP or HP to be granted to the user, not stolen away from the enemy.

that said, will plug that code you provided into my pre-damage js in the notetags to see iif it works.

I believe it should be: user.gainMp(Math.ceil(10/20))
In order to make it come out to 5%

ok so this DOES work, but it's kind of wonky.
The SP that gets restored can come out as a fraction, im mostly seeing 3.25 restored with my formula at level 1.

"a.gainMp(a.mmp * 0.05); 1.1 * a.mat * 2 - b.mdf * 0.4625" is what I currently have as my formula, for reference.

Apologies for that, you're correct that I am indeed usiing Visustella. I was told not to mention them on here or the post would get deleted, so that's why I didn't. I'll be sure to iinclude that info if I need help again.

As for the plugin, they do have a note tag called <Life steal>, but its not what im looking for, for the reasons mentioned above. I just want MP or HP to be granted to the user, not stolen away from the enemy.

that said, will plug that code you provided into my pre-damage js in the notetags to see iif it works.

I believe it should be: user.gainMp(Math.ceil(10/20))
In order to make it come out to 5%
Just tried the code out. It also... kinda works. But it seems to only restore 1 mp, no matter what's in the value section.
What’s you Max MP ?
I was told not to mention them on here or the post would get deleted
you were told wrong 😛

that said, will plug that code you provided into my pre-damage js in the notetags to see iif it works.
youll probably have to put it into post-damage for best results

I believe it should be: user.gainMp(Math.ceil(10/20))
In order to make it come out to 5%
it needs to factor in value somehow. as of right now, that would always restore 1 mp per hit as youve just made it Math.ceil(1/2), which will round up to 1

you didnt have to change anything
a.gainMp(a.mmp * 0.05) Is just gonna give a flat 5% of whatever that characters current max Mp is, so if it’s less than 100 that could make sense.
What’s you Max MP ?
this character's max mp is 65, topping to around 151 at the max level, which in this game would be 50.

you were told wrong 😛


youll probably have to put it into post-damage for best results


a number divided by 20 is 5% of that number. i didnt want to hit shift to type *.05 when /20 will do.

but it also needs to factor in value somehow. as of right now, that would always restore 1 mp per hit as youve just made it Math.ceil(1/2), which will round up to 1

you didnt have to change anything
...... *I am incredibly dumb LMAO*

I'm still learniing JS here, I apologize lmao. Will give that a try riight now lol.

EDIT SO I DONT FLOOD THE THREAD CAUSE FORGOT I COULD DO THAT: I tested it out and iit worked! Might play around a bit to see if I wanna change it to 10% or so, but this'll do! Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/creating-a-skill-that-restores-5-mp-relative-to-damage-dealt-by-the-skill.175246/