Stackable TGR state

So, i came up with this wile looking at a yanfly Tips & Tricks video and i was wondering if the user TGR will increase and stack or not.

 

Spoiler
<Custom Apply Effect>
// Make sure the stack count exists.
user._stackingTGR = user._stackingTGR || 0;
// Increase the stack count.
user._stackingTGR += 1;
</Custom Apply Effect>


<Custom Remove Effect>
// Reset the stack count.
user._stackingTGR = 0;
</Custom Remove Effect>


<Custom Conclude Effect>
// Make sure the stack count exists.
user._stackingTGR = user._stackingTGR || 1;
// Sets the stacks variable to the stack count.
var stacks = user._stackingTGR
// The damage formula used per tick.
var TGR = stacks * 10;
// Play poison animation on the target.
user.startAnimation(59);
// Clear the results.
user.clearResult();
// Check if the target is dead.
if (user.isDead()) {
  // If the target is dead, make it collapse.
  user.performCollapse();
}
</Custom Conclude Effect>





I need this to be used with this plugin.
I can't find a way to have a script change the tgr parameter. Any attempt to change it forces it to immediately change back, in my experience.


If you can figure out how to have that change stick, you'd set up a state somewhat like the following:

Spoiler
<stateDescription:Generating TGR with actions taken>


<Custom Passive Condition>


if ($gameParty.inBattle()){


condition = true


}else{


condition = false


}


</Custom Passive Condition>


<Custom Action End Effect>


console.log(user.tgr)


user.tgr = (user.tgr + 0.05)


user.stacks = user.stacks + 1


console.log(user.stacks)


</Custom Action End Effect>


<Custom Battle End Effect>


this.tgr = (this.tgr - (0.05 * this.stacks))


this.stacks = 0


</Custom Battle End Effect>

Which is pretty rudimentary, but should reset TGR back to default when a battle ends.

Original thread: https://forums.rpgmakerweb.com/threads/stackable-tgr-state.65403/