Mana regen how and where to change formula

Hello!

I am wondering if there is any place I can readjust the actual formula for the mana regen? This is due to me using luck as wisdom and is used to calculate mana regen. Currently it is used as a percent but I would like it to be a flat rate. I found a thread that used Yanfly's buffs and states plugin but then I would need to use a state which is not what I would like.

If an actor has 6 Luck they should gain 6 mp/turn, or if you want to get specific the formula I want to use is:
a.luk^0.9 mp/turn.

So if anyone knows how to include this I'd be forever grateful! 🙂

Best regards,
What I do is just run a common event at the end of every turn. In it, use variables to set the amount of MP regen you want, and increase Actor MP by that value of that variable. Do that for every Actor.
Copy paste that troop page into every encounter you got.
What I do is just run a common event at the end of every turn. In it, use variables to set the amount of MP regen you want, and increase Actor MP by that value of that variable. Do that for every Actor.
Copy paste that troop page into every encounter you got.
I am always trying to avoid copy-paste.

I found on line 3243 in rpg_objects.js. That's where the mrg formula is. Removing it and adding this.luk seems to make it a flat rate.
I am curious however if rpg makers java script allows for exponentials? I am not adept in java script and as I imagine this.luk^0.9 does not work...
1596130716176.png
You could also use Yanfly's Base Troop Events so that you don't have to copy paste
@Milennin's suggestion into every troop. That way you only need to configure one single troop.
Googling "Javascript exponents" reveals the Math.pow() function. So you'd represent it as Math.floor(Math.pow(this.luk, 0.9))
Googling "Javascript exponents" reveals the Math.pow() function. So you'd represent it as Math.floor(Math.pow(this.luk, 0.9))
Yeah, found it as well. Was just editing the previous post when I saw new answers came in 🙂

I wrote below in the rpg_objects.js on line 3243.
var value = Math.floor(Math.pow(this.luk, 0.9));

If there's a reason not to edit this file please tell me 🙂

Want to say thanks to everyone since you always get quick responses here! 🙂

best regards,
Bishiba
The only thing you need to consider now is that any trait that grants mana regeneration does no longer work.

You can't slap Mana regeneration on Weapons, Armors, Enemies etc.
But then again, you can just substitute the usual mrg with luk instead.
The only thing you need to consider now is that any trait that grants mana regeneration does no longer work.

You can't slap Mana regeneration on Weapons, Armors, Enemies etc.
But then again, you can just substitute the usual mrg with luk instead.
Indeed, I've renamed Luck to wisdom, so it's all good 🙂 But still, good to say if someone ever read this thread later 🙂

Could also add the previous code back in and use both at the same time.
Haven't tested it but looks fine:
1596132323284.png
Indeed, that should work.

Someone correct me if I'm wrong, but can't you just write ** instead of Math.pow()?

var value = (this.luk**0.9) + (this.mmp*this.mrg);


Edit: Also, if you don't need natural mana regen at all, you could also do it like this:

var value = (this.luk**0.9) * (1 + this.mrg);

That way, mrg does affect the custom formula you set up.
Someone correct me if I'm wrong, but can't you just write ** instead of Math.pow()?

Indeed, it looks like you can! I'm not sure why there's both an operator and a function for it.
Indeed, that should work.

Someone correct me if I'm wrong, but can't you just write ** instead of Math.pow()?

var value = (this.luk**0.9) + (this.mmp*this.mrg);


Edit: Also, if you don't need natural mana regen at all, you could also do it like this:

var value = (this.luk**0.9) * (1 + this.mrg);

That way, mrg does affect the custom formula you set up.
Huh, interesting that **=^. But yes I decided in the end to use mrg+luk for the formula.
Then I spent Quite some time making this new formula compatible with yanfly's status window. So now it accurately depicts mp/turn 🙂

I do feel this solution is nicer than having to add more passive states and such with Yanfly plugins.
Indeed, it looks like you can! I'm not sure why there's both an operator and a function for it.
I think the operator was added to the language later on or something.

Incidentally, ^ is XOR, just in case anyone was wondering what that actually does.

Original thread: https://forums.rpgmakerweb.com/threads/mana-regen-how-and-where-to-change-formula.124745/