Assign MP Regen Rate to a variable?

Is there a way to assign MP Regen Rate to a variable? I need that to designate how much mp will be saved depending on the current MP regen rate the player has (it can vary according to the equipments the player is using).
I couldn't find the option in MV's database.
I believe this is the correct script call to use.

$gameVariables.setValue(var, $gameActors._data[actorID]._xparam[paramID]);

This is the script call to assign a value to a particular variable:

$gameVariables.setValue(var, value);

And this, I believe, is the script call to reference an actor's ex-parameter:

$gameActors._data[actorID]._xparam[paramID]

In theory, you just need to replace the value in the first with the ex-param reference.
There's no need to remember the ID of the xparam. Each xparam has a 3-letter abbreviation. For MP regen, it's "mrg", so just write $gameActors.actor(actorID).mrg.

Note:

  • $gameActors.actor(actorID) is almost the same as $gameActors._data[actorID]. The only difference is that the latter could fail if the actor is not in the party.
  • The xparam method does work but the syntax is xparam(id), not _xparam[id].
Thanks for the correction.

So to be clear, it would look like this?

$gameVariables.setValue(var, $gameActors.actor(actorID).mrg);
Yes; however if you're not in a large Script block already, I would instead use a Control Variables command and just paste $gameActors.actor(actorID).mrg into the Script field.

Also: note that the value is a ratio rather than a percentage. Multiply by 100 to get a percentage.
I've tried all the scripts you said, but the ones without "mrg" crashed the game.
The ones with mrg, however, don't seem to show any number other than 0 and I'm not sure what to do. I've done many tests using items, no actor parameters, 1 mp regen actor parameter, but none gave me a different result 🙁

Event:
1592970818695.png


Actor's parameters:
1592970890694.png

Armor's parameters:
1592970904233.png


Result with or without armor:
1592970876246.png

Original thread: https://forums.rpgmakerweb.com/threads/assign-mp-regen-rate-to-a-variable.122896/