Set Parameters to a Number?

I'm making a game where ammo is being implemented, and mana is used in it. The mana is going to be set to the currently equipped gun's ammo clip, and I have multiple guns with varying amounts of ammo clips. I need a script to set max mana, not just increase or decrease.
$game_actors[x].mmp = 10$game_actors[x].mp = 10Where x is the actor id.

Don't know if you need the second line, but i would do it for completeness

If you want to keep the current amount of mana (capped at the new clip size), change the second line to:

Code:
$game_actors[x].mp = [$game_actors[x].mp, $game_actors[x].mmp].min
Despite my best efforts, I cannot get this to work for me. I am not 100% sure if this is for script or script call, so I tried both. Neither are working for me. I get the following error.

igxpmo.jpg


I don't know what I'm doing wrong here.
Ah, yeah, MMP is per default read-only.

It should work after adding this snippet:

class Game_Actor < Game_Battler     def mmp(value)        param(1) = value    end endand changing the first line to:

$game_actors[x].mmp(10)Also, i just realized that you can just call

$game_actors[x].refreshInstead of the 2nd line.
So I added this into scripts under Materials and got this.

x3vkfk.jpg


Also, was not even able to enter game. Got this error upon play testing.
Meh, i shouldn't directly mess with variables that aren't meant for editing...

This time i actually tested my stuff ^^

class Game_Actor < Game_Battler   def set_mmp(value)    add_param(1, -(mmp - value))  end end
Code:
$game_actors[x].set_mmp(10)
You could actually do this via events only. What i'm doing:

1) Get the current MMP

2) Calculate the diference between current and desired value

3) Subtract the difference

Note that your MMP will still change on level up, unless you modify the MMP curve to be flat.
Thank you so much. You cannot believe how long I have been working on this. I was getting close to giving up hope on it and scraping the idea. Once again, thank you.

Original thread: https://forums.rpgmakerweb.com/threads/set-parameters-to-a-number.39032/