ZoeZero

Veteran
Veteran
Joined
Oct 14, 2019
Messages
37
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
609
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
618
Reaction score
260
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
609
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
618
Reaction score
260
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
37
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
 

Latest Threads

Latest Posts

Latest Profile Posts

I couldn't help myself, so I edited the tiles a bit and made a birdhouse :LZSsmile: I hope I will finish the town today!Screenshot 2021-09-17 134349.png
How do I find the threads I have watched? It's been so long I've forgotten :kaoswt:
So far, this is how the wall tileset its looking in-editor. :kaoswt2:
1631863283853.png
Still thinking on details to add.
Added a plugin to RMMV Plugin Releases with all relevant info but it looks like the topic wasn't approved for whatever reason. Cool.
Working in the IT industry:
- "How long does it take?".
- "It takes 1 month".
- "What if we add more people to the project?".
- "It would take 2 months".

Forum statistics

Threads
115,128
Messages
1,087,440
Members
149,626
Latest member
lucky_Floki
Top