Hello there,
I'm using this code on a state notag for stacking buff. It work fine but at the end of the state/battle, the stats buffed keep. The State is set up for be removed at the end of the fight.
----------------------------
----------------------------
I'm using this code on a state notag for stacking buff. It work fine but at the end of the state/battle, the stats buffed keep. The State is set up for be removed at the end of the fight.
Code:
<Custom Apply Effect>
user._stack = user._stack || 0;
user._paramUp = user._paramUp || [];
for(i = 2; i < 6; i++){
user._paramUp[i] = user._paramUp[i] || (Math.round(user.param(i) * 0.25));
if(user._stack < 2){
user.addParam(i, user._paramUp[i]);
}
}
user._stack++;
user._stack = Math.min(user._stack, 2);
</Custom Apply Effect>
<Custom Remove Effect>
user._stack = user._stack || 0;
user._paramUp = user._paramUp || [];
for(j = user._stack; j > 0; j--){
for(i = 2; i < 6; i++){
user._paramUp[i] = user._paramUp[i] || (Math.round(user.param(i) * 0.25));
if(j > 0){
user.addParam(i, -user._paramsUp[i]);
}
}
}
user._stack = undefined;
user._paramUp = undefined;
</Custom Remove Effect>
Code:
TypeError: Cannot read property '2' of undefined
at eval (eval at Game_Battler.customEffectEval (YEP_BuffsStatesCore.js:1378), <anonymous>:7:33)
at Game_Actor.Game_Battler.customEffectEval (YEP_BuffsStatesCore.js:1378)
at Game_Actor.Game_Battler.removeStateEffects (YEP_BuffsStatesCore.js:1411)
at Game_Actor.Game_Battler.removeState (YEP_BuffsStatesCore.js:1405)
at Game_Actor.Game_Battler.removeState (YEP_X_VisualStateFX.js:308)
at Game_Actor.Game_Battler.removeState (YEP_AutoPassiveStates.js:566)
at Game_Actor.Game_BattlerBase.updateStateTurnTiming (YEP_BattleEngineCore.js:3633)
at Game_Actor.Game_BattlerBase.updateStateTurnTiming (YEP_BuffsStatesCore.js:1513)
at Game_Actor.Game_BattlerBase.updateStateTurnEnd (YEP_BattleEngineCore.js:3650)
at Game_Actor.Game_BattlerBase.updateStateTurns (YEP_BattleEngineCore.js:3610)
Code:
user._stack = user._stack || 0;
user._paramUp = user._paramUp || [];
for(j = user._stack; j > 0; j--){
for(i = 2; i < 6; i++){
user._paramUp[i] = user._paramUp[i] || (Math.round(user.param(i) * 0.25));
if(j > 0){
user.addParam(i, -user._paramsUp[i]);
}
}
}
user._stack = undefined;
user._paramUp = undefined;