[Solved] % of damage converted to MP gain?

Status
Not open for further replies.

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
So the way I did it in my game is:

var dmg = (a.atk * 1.5) - b.def; a.gainMp(Math.floor(dmg * 0.1)); dmg

This would mean that i would gain back 10% of my damage done as MP right?

So why is it, when I do 100 somthing damage, i only get back like 6 MP?

Since when is 6 10% of 100?

What am i doing wrong? lol
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,382
Reaction score
1,567
First Language
English
Primarily Uses
RMMV
Do you have any variance on the damage?
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
Do you have any variance on the damage?
Yep. And does that affect the MP gain? can I have the MP gain always be 10% of the damage delt without being affected by variance?
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,382
Reaction score
1,567
First Language
English
Primarily Uses
RMMV
The problem is that the variance is calculated after the damage formula is, so your MP gain from just doing it that way is pretty much always going to be based on the raw value. Short of getting rid of variance in attacks entirely, your best bet is using Yanfly's Skill Core plugin and adding the MP restoration as a Post-Damage Effect notetag.

The alternative if you don't want to go down that route is setting the variance in the database itself to 0% and incorporating the variance calculation into your damage formula, but that still won't account for things like elemental weaknesses.
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
The problem is that the variance is calculated after the damage formula is, so your MP gain from just doing it that way is pretty much always going to be based on the raw value. Short of getting rid of variance in attacks entirely, your best bet is using Yanfly's Skill Core plugin and adding the MP restoration as a Post-Damage Effect notetag.

The alternative if you don't want to go down that route is setting the variance in the database itself to 0% and incorporating the variance calculation into your damage formula, but that still won't account for things like elemental weaknesses.
So apperently I have no idea how to use the Lunatic Mode in the Skill Core.

What I have (and dosnt work) is:

<Post-Damage Eval>

value = a.gainMp(Math.floor(dmg * 0.1))

</Post-Damage Eval>
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,153
Reaction score
529
First Language
English
Primarily Uses
RMMV
You don’t want to reset the value, that does nothing post damage. You want to use the value as the +MP.

var magic = value
user.gainMp(magic)

something like this ^^
substitute ‘magic’ for any word you want
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
You don’t want to reset the value, that does nothing post damage. You want to use the value as the +MP.

var magic = value
user.gainMp(magic)

something like this ^^
substitute ‘magic’ for any word you want
Thank you for that. I feel we are getting somewhere, but this still wont allow for MP gain. Tried looking into console to see if any errors popped up and I got nothing.

My current eval

Code:
<Post-Damage Eval>
var magic = value;
user.gainMp(Math.floor(magic * 0.1));
</Post-Damage Eval>
I feel like I am doing something wrong. Lol. I really suck at this.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
503
Reaction score
220
First Language
English
Primarily Uses
RMMV
With that formula, you need to do at least 10 damage before you gain any MP. Is that what you want?

Side note: you don't need the variable, just user.gainMp(value) should be enough.
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
With that formula, you need to do at least 10 damage before you gain any MP. Is that what you want?

Side note: you don't need the variable, just user.gainMp(value) should be enough.
See, thats what I am talking about. No idea what I am doing.

What I wanted was to have a percentage of ANY damage the main attack does (10%) to be converted to mp gain.

Lets say I do 100 damage. 10 of the damage will be given to me as mp gain.

Would that just be user.gainMp(value * 0.1)?
 

Aesica

undefined
Veteran
Joined
May 12, 2018
Messages
1,343
Reaction score
1,226
First Language
English
Primarily Uses
RMMV
I know you use a few of my plugins, so if AES_BattleCore is one of them, you can take advantage of its manual variance function via the formula box. Just make sure you set the formula box variance to 0%, then...

Formula box:
Code:
c = Aesica.BattleCore.variance(YOUR_DAMAGE_FORMULA_HERE, 0.1); a.gainMp(Math.floor(c * 0.1)); c
This way, the variance will be calculated as part of the damage formula, not afterward so the rest should work as expected.

Edit: There's also Yanfly's lifesteal (is that still a free plugin?) where it's as easy as putting a note tag in the skill:

<MP Life Steal: 10%>
 

Jenova

Because you are...a puppet!
Veteran
Joined
Nov 29, 2017
Messages
338
Reaction score
183
First Language
English
Primarily Uses
RMMV
I know you use a few of my plugins, so if AES_BattleCore is one of them, you can take advantage of its manual variance function via the formula box. Just make sure you set the formula box variance to 0%, then...

Formula box:
Code:
c = Aesica.BattleCore.variance(YOUR_DAMAGE_FORMULA_HERE, 0.1); a.gainMp(Math.floor(c * 0.1)); c
This way, the variance will be calculated as part of the damage formula, not afterward so the rest should work as expected.

Edit: There's also Yanfly's lifesteal (is that still a free plugin?) where it's as easy as putting a note tag in the skill:

<MP Life Steal: 10%>
I have this weird thing where if I think about something a lot it will happen and I was literally just thinking about you because I know your plugins are so Yanfly compatible so i figured maybe you had something in one of your plugins with the same kind of features.

I looked and sadly could not find it. Thank you for telling me.

Definatly will look into the MP life steal. I thought it was only HP so that didn't even occur to me.

EDIT: MP life steal totally worked. Thank you for being a lifesaver, once again. LMAO. What would I do without this community....
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,029
Reaction score
4,770
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How do you cure sleep problem? It has been 7 months and it's 3 AM now..
Darn you, Seals! Why do you gotta be so cute when on land?:kaoluv:
So dragonbones getting laggy xD
I even removed the fingers armatures.

Have to remake this guy after crashing ( corrupted file).
:rtear:

Although limited to only this shop for room decorations, I like this aspect for previewing items.

Forum statistics

Threads
100,837
Messages
980,130
Members
132,487
Latest member
AnthonyDewitt
Top