[Solve]Set parameter by set not - or +

Solve with some math work
I store what ever modify status
and then + it later
------------

I do a buy status by gold system
and want to set parameter like maxhp by variable scale formular
but in editor there only increase/decrease
is there other way around
or I need to decrease param to 0
then increase it back to what I want to set
thank you
Capture.JPG
Normally, you cant "set" the parameters to a value because the parameters are actually functions that return a value via a formula. The add/subtract event command only actually applies to the param plus parameter of those functions.

Unless you change the code which does the formula, your only other choice really is to subtract a value that will make the result zero, then add the value that you want.
The change parameter command will change a value that is added to the actor base value of that parameter. That is an important difference because if your actor has a class that changes the parameter by level, then those changes will always appear (and that level mechanic is why an added parameter needs to be changed, not the original class-based parameter).

That said, you could theoretically do this by calculating the difference with the control variable command. That command gets you the current total of that parameter (with all internal effects added), and then you can calculate the difference between that and what you want with a second control variable command.

However, it would be much better if you use a plugin to replace the base parameter formulae - such plugins already exist.
You could do this by decreasing to 1 (most parameters can't go below 1) then by increasing by the desired amount minus 1, so that for example if you want to set a parameter to 150 you'd decrease by 9999 then increase by 149.

You could also do this by setting a variable equal to the character's current parameter, then subtracting the character's current parameter, and finally increasing the parameter by the result (which might be negative if the character's current parameter is higher than the desired result), so that for example if you want to set a parameter to 150 you'd copy the character's current param into a variable, subtract 150 from that variable, then increase the character's param by the amount in that variable.

However, like @Andar suggested, this is usually not a safe way to handle parameter changes, because factors such as a character's current Class and current Equipment can modify what their parameters are. So if the character had equipment that gives them +50 AGI and you set their AGI to 150, then they take the equip off, now they only have 100 AGI... whereas if the character had equipment that gives them +10 AGI and you set their AGI to 150, now they have 140 AGI. They were heavily punished for wearing a high-AGI equip right before you "set" their AGI to 150. This is why RPG Maker is designed to increase/decrease, rather than directly set, parameters.

There are base parameters for characters that RPG Maker already tracks which don't include equipment or classes, I think... so if you use a plugin or a bit of scripting language to access these, you could probably set them to a fixed value safely without causing any issues. "Plugin Requests" or "Learning JavaScript" would be a better place to find people who could tell you how to do it.
thank you all
I saw yanfly base parameter plugin
but that plugin can't use variable like

<mhp Plus: +$gameVariables.value(12)>

it's allow +100 +50 etc
that not what I looking for
or not sure If I make the wrong test - -*

now I do with clear all equipment then change prameter method instead
<mhp Plus: +$gameVariables.value(12)>
Wrong - you CAN use variables there, but you need to use the lunatic options of that plugin, not the simple base change notes.
thank you Andar
I read that lunatic mode
but it say function
I don't understand function then ignore it
just find out that it can do by script call - -*
"function" is the technical name of something that can be used in a script command.
And you would NOT use it in a script call, because as said above it cannot work as a script call - it needs a replacement code for the formulae used for the parameter. That's why the name "function" was used instead of "script call".
Almost every script call uses functions, but functions can be used where script calls can't be used, and that use is required here.

you simply can't do what you want with a script call because that would cause the problems mentioned above.
If you don't understand the difference and how to use javascript functions, then you have two options: 1) learn how to use or 2) change what your game is supposed to do.

Original thread: https://forums.rpgmakerweb.com/threads/solve-set-parameter-by-set-not-or.106756/