MZ tic based battle regen

Normally you take damage/regenerate i.e. poison/regen states during turns regardless of battle system. I which to change this and have the effect applied on a counter which is state dependent and specified by the note tag.

I'm using VS ATB battle system if that is important here.

Thank you for all your time and hard your work in advance btw it's much appreciated!
I hope using these scripts together can meet your needs:
DoubleX_RMMZ_TPBS_Countdown_States
DoubleX RMMZ State Triggers
The state trigger notetag can be something like this:
Code:
<state triggers turn val script: true, x>
And the script event command for setting the game variable with id x for the tick-based regen can be something like this:
JavaScript:
$gameVariables.setValue(x, `
    this._result.clear();
    this._result.used = this._result.success = true;
    this._result.hpAffected = true;
    this.gainHp(y);
    this.startDamagePopup();
`);
Where y is the amount of hp gained per regen.
Finally, the TPBS countdown state notetag can be something like this(it only works in TPBS):
<countdown states interval val val: true, z>
This makes the state turn counter to be updated(and thus the regen to be triggered) every z seconds 🙂

Original thread: https://forums.rpgmakerweb.com/threads/tic-based-battle-regen.128997/