Hey all (again). Been a minute. Got a question about a VS (VisuStella) modification. I don't particularly like how VS chose to do their coding / plugins, but it's a "necessary evil" for the game concept I have, and my limited coding knowledge / skill.
That said, in RPGM-MV, a person could use Yanfly's Base Parameter plugin (or any of the other parameter plugins) to EASILY add variables to the calculation, because the formula was listed for EACH parameter, thus, each parameter could be modified on an individual basis. For example, you could add something like the following to the ATK parameter:
(base + plus) * paramRate * buffRate + flat + v[19]
if you wanted to add variable 19 to your game's ATK calculations.
In the VS plugins of MZ, however, I see no such way to do this. I DID find the JS code section under the Core Engine plugin (Core Engine > Parameter Settings > Basic Parameters > JS: Formula), & it looks like this...
I see the place where I could edit the Base Parameter formula, but the way it is currently coded means that I could only add a single var to the line with the "<---" beside it, because it seems to be coded in such a way to calculate ALL of the Base Parameters with that single line, vs on an individual basis.
Herein lies my problem. I have a system that uses variables as modifiers to my Base Parameters, and I wouldn't say that what I'm trying to do falls into the realm of "custom parameters" because all I need is a way to add my variables to each parameter in the same way that the "flatBonus" is added. Thoughts?
That said, in RPGM-MV, a person could use Yanfly's Base Parameter plugin (or any of the other parameter plugins) to EASILY add variables to the calculation, because the formula was listed for EACH parameter, thus, each parameter could be modified on an individual basis. For example, you could add something like the following to the ATK parameter:
(base + plus) * paramRate * buffRate + flat + v[19]
if you wanted to add variable 19 to your game's ATK calculations.
In the VS plugins of MZ, however, I see no such way to do this. I DID find the JS code section under the Core Engine plugin (Core Engine > Parameter Settings > Basic Parameters > JS: Formula), & it looks like this...
JavaScript:
// Determine the variables used in this calculation.
let paramId = arguments[0];
let base = this.paramBase(paramId);
let plus = this.paramPlus(paramId);
let paramRate = this.paramRate(paramId);
let buffRate = this.paramBuffRate(paramId);
let flatBonus = this.paramFlatBonus(paramId);
// Formula to determine total parameter value.
let value = (base + plus) * paramRate * buffRate + flatBonus; <---
// Determine the limits
const maxValue = this.paramMax(paramId);
const minValue = this.paramMin(paramId);
// Final value
return Math.round(value.clamp(minValue, maxValue));
I see the place where I could edit the Base Parameter formula, but the way it is currently coded means that I could only add a single var to the line with the "<---" beside it, because it seems to be coded in such a way to calculate ALL of the Base Parameters with that single line, vs on an individual basis.
Herein lies my problem. I have a system that uses variables as modifiers to my Base Parameters, and I wouldn't say that what I'm trying to do falls into the realm of "custom parameters" because all I need is a way to add my variables to each parameter in the same way that the "flatBonus" is added. Thoughts?