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
632
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
632
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 Profile Posts

Who's a fan of firearms? The 5 on the bottom row (not including the green laser ones) I made pretty recently. I plan for most of these to be in my project.

Screenshot 2021-09-28 165924.png
Doing RPG Maker News for 28th September 2021

RMMV - Skip script errors:

For game developer testing purposes.
You know, I really get to farm likes since I post all of @Avery and @hiddenone 's blog tutorials on the forums...
Back from a very long hiatus with a new project woo
This is my battler placeholder image trying out art styles too I want to fake a backview battle system
I think I will want portraits and battle sprites to be 2D and stick to pixel art for overworld not 100%sure but pretty sure its easier to make pixel art for overworld sprites, events and maps and stuff.
Placeholder.png

Forum statistics

Threads
115,441
Messages
1,089,951
Members
150,229
Latest member
Mythphnx
Top