Changing Parameter Values Via Script

Yes, for one that is what the yanfly plugins called Extra Param Control and Specual param control does (albeit +more). It lets you control the ex/sp params.

What that plugin does is give you a new formula which now incorporates a "plus" variable which you can modify in-game.

So basically, when you want to modify a certain x/s param you just modify that "plus" variable via the given script call

Now ofc those plugins only work for x/p params, but it seems that is what u need for now at least.

If you want control for all Traits, Galv has a plugin called MV Dynamic Traits
OK, well I am excited to see what Ahuramazda comes back with. Always love to see people energized to try stuff rather than grab the crutch ya know. Hehehe. But when all is said and done it sounds like it might be beneficial to peruse the code under the Extra Param Control plugin.

Kind of amazing how close something like that little line of code I started the post out with is so perfect, and yet to get the same thing from its cousin parameters is a n̶i̶g̶h̶t̶m̶a̶r̶e̶ bit more involved. "So close, but yet so far away" as the kids say.

BTW do you know how to make a users name hot when referencing them? I can't figure it out.
Btw in case you missed my edit

If you want control for all Traits, Galv has a plugin called MV Dynamic Traits

Hmmm I forgot how to do the name thing

TBH, if you're fine with a JS file I could have also just written something earlier.. Lolz
Btw in case you missed my edit

I did miss the edit. So this is highly interesting, his plugin description actually says "Add traits to actors during the game via script call" - but we've already proven here there is no way he means ex/sp parameters as well, right?

TBH, if you're fine with a JS file I could have also just written something earlier.. Lolz
Fine with it? It's the only way I am going to roll! BUT I am not sure I want to play my favor card with you just yet fine (and busy) sir. Besides I probably already owe you a coffee or two if I dig through old threads 🙂
Remember that X/S Params are added via Traits. So if you can add Traits, you can add X/S Params. Basically when you ask the engine for the actual value of X/S params of an actor, it collects ALL traits for it (actor,class,equips,states) and get its total. So by adding another of the trait for the X/S param, you will end up with added value to that X/S param

Actually, adding them is better than editing the data in $dataActors directly since as I've outlined before that can have serious consequences

Lolz, actually my logical flow will be same as Galv's anyway so not much point in me writing one just for this case haha
Wanted to say I am working on this, but I won't have anything presentable til this afternoon at earliest... I am making it as as plugin mainly to use in my own game, but I will gladly share it and see if you like the idea or would prefer to roll with someone elses work 🙂
In this thread lies three persons who all prefer to use their own stuff. Wahahahahaha.

Except right now Im too lazy to make the full transition to MV so I dont have motivation to write things up...
Remember that X/S Params are added via Traits. So if you can add Traits, you can add X/S Params.
Are you saying I've been asking the wrong question? If all I said was "How do we push traits (which happen to containin xm/sp parameter values) to actors via JS" the answer is somehow much easier than pushing the parameters directly?

Wanted to say I am working on this, but I won't have anything presentable til this afternoon at earliest... I am making it as as plugin mainly to use in my own game, but I will gladly share it and see if you like the idea or would prefer to roll with someone elses work 🙂
Take your time, not going anywhere.

In this thread lies three persons who all prefer to use their own stuff.
Three persons who capture the long lost essence and forgotten meaning of RPG MAKER. [Cue ending theme music from TV's The Incredible Hulk]
The question isnt wrong, its just that your question was simply focused on X/S params which are actually a part of a bigger set which is called Traits
The question isnt wrong, its just that your question was simply focused on X/S params which are actually a part of a bigger set which is called Traits
Right, was just hoping maybe focusing on traits instead of params changed the scope of the project somehow (for the better).
OK, not going to lie... this is actually much harder to get working for me than I was expecting (I'm far from being an experienced coder), so I won't be sharing my butchery of this idea. I looked into some other peoples stuff and I can say I may have been on the right track, but farm from achieving my idea in a good method. Yanfly seems to be able to do the same thing I was looking at doing for sure, Ill need to test a bit more to make certain though. :/

Not saying I'm giving up on the idea of making my own version of this, but I need to learn a bit more and toy with ideas much longer than I would be willing to make someone else wait to see come to fruition.
And I'll still be interested, more so that you're not giving up than what you end up with at this point.

FWIW I've also reached out to trihan for fun, and got some initial feedback. More to come.

P.S.
this is actually much harder to get working for me than I was expecting
For future record, if it is a question I asked the answer is never "oh that's easy, you just...". Ever.
Oh no, it wasn't anything asked or pointed out here in this thread... I just severely under estimated the complications of doing this the way I had visualized it, lol. When I was imagining how it would work it sounded so simple in my head, but there as so many other interactions I wasn't taking into consideration.
Oh no, it wasn't anything asked or pointed out here in this thread... I just severely under estimated the complications of doing this the way I had visualized it, lol. When I was imagining how it would work it sounded so simple in my head, but there as so many other interactions I wasn't taking into consideration.
Oh don't mind me, I was just being sarcastic and all doom and gloom on what it takes to make seemingly straight forward things happen.
Believe me when I asked the question, any question, the answer always "sounds simple in my head". 🙂
I'm starting to realize, the one thing RPG Maker is motivating me to do more than anything else, is make my own engine (LOL!)
Not sure if it is helpful, but anyways:

Kind of amazing how close something like that little line of code I started the post out with is so perfect, and yet to get the same thing from its cousin parameters is a n̶i̶g̶h̶t̶m̶a̶r̶e̶ bit more involved.
Actually, increasing x- and s-params shouldn't be inherently more difficult than normal parameters. However, while the addParam function is utilized in growth effects in items/skills and the "Change Parameter" event command, there is no need for a similar function for the other parameter types by default, so there is none in the standard plugins.

I may overlook something here too, but if you just want to replicate addParam for the other parameters the result could look like this:
Spoiler
Code:
function() {

Game_BattlerBase.prototype.clearParamPlus_ILC_addSXParams =
    Game_BattlerBase.prototype.clearParamPlus;
Game_BattlerBase.prototype.clearParamPlus = function() {
    this.clearParamPlus_ILC_addSXParams();
    this._xparamPlus = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    this._sparamPlus = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
};

Game_BattlerBase.prototype.addXparam(paramId, value) {
    this._xparamPlus[paramId] += value;
    this.refresh();
};

Game_BattlerBase.prototype.addSparam(paramId, value) {
    this._sparamPlus[paramId] += value;
    this.refresh();
};

Game_BattlerBase.prototype.xparam_ILC_addSXParams =
    Game_BattlerBase.prototype.xparam;
Game_BattlerBase.prototype.xparam = function(paramId) {
    return this.xparam_ILC_addSXParams(paramId) + this._xparamPlus[paramId];
};

Game_BattlerBase.prototype.sparam_ILC_addSXParams =
    Game_BattlerBase.prototype.sparam;
Game_BattlerBase.prototype.sparam = function(paramId) {
    return this.sparam_ILC_addSXParams(paramId) + this._sparamPlus[paramId];
};

}();
This example would allow you to increase the other parameters by replacing addParam by addSparam or addXparam (the values are added to the final parameter value in line 12 and 17 of the plugin. In case of sparams I don't know if that's that useful though).


For comparison, this is how the additional base parameters are implemented:
Spoiler
One function is used for initialization and reset of bonus parameter list. The list is stored as part of each particular battler and contains an entry for every parameter. The function is called on battler creation and when (re-)setting up an actor (when the "Initialize" option is checked in the "Change Party Member" event command):
Code:
Game_BattlerBase.prototype.clearParamPlus = function() {
    this._paramPlus = [0,0,0,0,0,0,0,0];
};

Adding a parameter bonus: Increase the corresponding bonus parameter entry. refresh is supposed to be called whenever parameters or traits change to update things like HP, MP and remaining states of the battler.
Code:
Game_BattlerBase.prototype.addParam = function(paramId, value) {
    this._paramPlus[paramId] += value;
    this.refresh();
};

Utilizing bonus parameters: The entries from the bonus parameter list are added to the base parameter value in the calculation. Calls like $gameActors.actor().atk will actually just delegate to that actors param function.
Bonus parameters are increased by equipment bonuses for actors.
Code:
Game_BattlerBase.prototype.paramPlus = function(paramId) {
    return this._paramPlus[paramId];
};

//...

Game_BattlerBase.prototype.param = function(paramId) {
    var value = this.paramBase(paramId) + this.paramPlus(paramId);
    value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
    var maxValue = this.paramMax(paramId);
    var minValue = this.paramMin(paramId);
    return Math.round(value.clamp(minValue, maxValue));
};

You can also look up these functions in the "rpg_objects.js" file in the "www/js" subfolder of your project.
but if you just want to replicate addParam for the other parameters

I am glad you said "just" because man it initially seemed like a "just" sorta concept in my mind. 🙂

I also appreciate the straight "overwrite" code approach as always.

OK this seems really cool on the surface, thanks for chiming in.

Waiting for engr-adiktuzmiko to pile on though, as far as it working for what we were sort of working towards in this thread. (the parameters changes sticking after exits, etc)

Original thread: https://forums.rpgmakerweb.com/threads/changing-parameter-values-via-script.98321/