Assign MP Regen Rate to a variable?

ZoeZero

Veteran
Veteran
Joined
Oct 14, 2019
Messages
32
Reaction score
4
First Language
Portuguese
Primarily Uses
RMMV
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.
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
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.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
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].
 

HumanNinjaToo

The Cheerful Pessimist
Veteran
Joined
Apr 18, 2013
Messages
1,226
Reaction score
603
First Language
English
Primarily Uses
RMMV
Thanks for the correction.

So to be clear, it would look like this?

$gameVariables.setValue(var, $gameActors.actor(actorID).mrg);
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
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.
 

ZoeZero

Veteran
Veteran
Joined
Oct 14, 2019
Messages
32
Reaction score
4
First Language
Portuguese
Primarily Uses
RMMV
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
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top