Adjust remaining turns of specific states in battle

Hello, good holiday everyone.


Please check below spell script. I'm using yanfly's buff & state, skill core scripts.

<Instant>


<Post-Damage Eval>


   // Randomize 1 to 100


   var RandN = Math.floor(Math.random()*100)+1


   if (RandN>=90) {


  // if target already has '13' state


      if (target.isStateAffected(13)){


  // increase remaining state turn by 1


     ???


      }


  // if target has not '13' state


      else


  // just add


      {target.addState(13)}


   }


</Post-Damage Eval>



I want to complete ??? part. How can I increase or decrease specific state's turn?


I should be very grateful to you if you might help me.
I solved this problem myself.


1) Get remaining turns with 'target.stateTurns(StateID)'


2) Apply new value with 'setStateTurns(StateID, value)'

Original thread: https://forums.rpgmakerweb.com/threads/adjust-remaining-turns-of-specific-states-in-battle.67816/