Yanfly's Base Param Control (Lunatic Mode)

So basically I wanna completely rip the base engines formula for actor/battler parameters and with this.
Anyways So...

This is the formula for hp and mp respectfully

MHP = (50 + (level * def) + plus) * 1 * buffRate + flat
MMP = (50 + (level * ((mat + mdf + luk) / 3)) + plus) * 1 * buffRate + flat

Error messages for both obviously are the same. Who else knows what else I'm doing wrong.
Code:
YEP_X_BattleSysCTB.js:2675 ReferenceError: level is not defined
    at eval (eval at Game_BattlerBase.param (YEP_BaseParamControl.js:680), <anonymous>:1:1)
    at Game_Actor.Game_BattlerBase.param (YEP_BaseParamControl.js:680)
    at Game_Actor.get (rpg_objects.js:2133)
    at Game_Actor.Game_BattlerBase.refresh (rpg_objects.js:2614)
    at Game_Actor.Game_BattlerBase.refresh (YEP_ExtraParamFormula.js:509)
    at Game_Actor.Game_BattlerBase.refresh (YEP_SpecialParamFormula.js:556)
    at Game_Actor.Game_BattlerBase.refresh (YEP_X_BattleSysCTB.js:1575)
    at Game_Actor.Game_Battler.refresh (rpg_objects.js:3000)
    at Game_Actor.Game_Battler.refresh (YEP_BaseParamControl.js:977)
    at Game_Actor.refresh (rpg_objects.js:3756)
It says level is not defined which means it cannot find an object called "level".. Maybe try changing it to ._level or this._level and see if it still errors or works
wait all params are properties so it should be user. But can i even define HP and MP before the other stats without getting errors...

C&P from text entry in plugin...
((user.isActor() ? 50 + (user.level * userdef) : base) + plus) * 1 * buffRate + flat

nope user.def is undefined.
But why is mp working?
If it evals them inside the Game_BattlerBase or any of its children (which seems to be the case), 'this' should work because thats the native variable that pertains to the battler object in question. Anyway, you can try them all and just see which one works.

But can i even define HP and MP before the other stats without getting errors..

Yes because the result of the params function isnt defined before you call the function itself. The parameters are actually functions not properties, that is also why you can modify their formulas (either directly in the js file or via Yanfly's plugin that you are using).. The only parameters that are properties would be the "base" parameters from the database, which are called by the params function and used in its default formula. But you need to make sure that there isnt any infinite loop in your formulas

Ex

MHP = 50 + def
DEF = 50 + mhp

This would result to an infinite loop because mhp will need def, while def needs mhp.
Ah thats why.

YEP_X_BattleSysCTB.js:2675 RangeError: Maximum call stack size exceeded
at Game_Actor.Game_Battler.customParamMax (YEP_BaseParamControl.js:1011)
at Game_Actor.customParamMax (YEP_BaseParamControl.js:1087)
at Game_Actor.Game_BattlerBase.paramMax (YEP_BaseParamControl.js:691)
at Game_Actor.paramMax (YEP_BaseParamControl.js:1083)
at Game_Actor.Game_BattlerBase.param (YEP_BaseParamControl.js:670)
at Game_Actor.get (rpg_objects.js:2139)
at eval (eval at Game_BattlerBase.param (YEP_BaseParamControl.js:680), <anonymous>:1:44)
at Game_Actor.Game_BattlerBase.param (YEP_BaseParamControl.js:680)
at Game_Actor.get (rpg_objects.js:2133)
at eval (eval at Game_BattlerBase.param (YEP_BaseParamControl.js:680), <anonymous>:1:7)
Maximum call stack size exceeded

That error call is normally an indicator for an infinite loop
indeed I had a loop some how.
Fixed.
So everything is working fine now?
Yes
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-base-param-control-lunatic-mode.106333/