How to set Max MP with an item?

Hello, I am quite new to RPG maker.
I attempted to make items change the player's Max MP value and refill it to full.

For example, item A will make Player's max MP become 30, and then refill MP to 30
item B will make Player's max MP become 60, and then refill MP to 60.

I tried to decrease by 9999 then increase by 30
but Player's max MP is still 0
How should I implement this feature properly?
Thank you very much
It's zero because you're decreasing by 9,999. The game will never return values lower than 0 for HP/MP/TP, or lower than 1 for the other parameters, but internally it's still -9,969 plus whatever the starting value was.

You need to set a variable equal to the current max MP:
Control Variables -> Game Data -> Actor -> Gale -> Max MP

Then you do
Change Parameter -> Gale -> Max MP -> Decrease -> Variable (the ID of the variable you just set)

Then
Change Parameter -> Gale -> Max MP -> Increase -> 30
ATT_Turan's suggestion is A-OK if you're not scaling Max MP with any traits or buffs. Otherwise it may produce unexpected results.

Change Parameter (and the Grow item/skill effect) only change part of the param formula. Here's a post where I explained that a bit more:
By default, actor parameters are calculated when needed:

(base + plus) * traitRate * buffRate
...where:
  • base is from the actor's class/level.
  • plus is from the Change Parameter command, i.e. the addParam method.
    • (This is only available for basic params: MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK).
  • traitRate is from parameter rate traits.
  • buffRate is from any active buffs/debuffs.
Without a plugin, there's no function to simply set a parameter to a specific value.

However, you could try something like this in a Script command:
JavaScript:
var actor = $gameActors.actor(1);
var add = 10 - actor.paramBase(2) - actor.paramPlus(2);
actor.addParam(2, add);
In theory this will make the ATK of actor 1 equal to 10 before traits/buffs are applied. Note that this does not remember the previous value!
Thank you two very much for the help!
I will go try if the solution works now

Original thread: https://forums.rpgmakerweb.com/threads/how-to-set-max-mp-with-an-item.153438/