TP Variable & Calculation

I need a bit of help here. I may be overthinking this, or just stupid and can't figure out how to calculate it properly.

Basically, I have a training simulation for battle. In my game, the TP you earn in combat transfers over to the next encounter. However, for training, I want TP to reset back to what it was when you started that simulation. That way players can't just farm TP on a training. Plus, you can retry training as much as you like. Here's what I've done so far...

Set a Variable to determine the TP at the start of that battle:

1698278202433.png


I then set a variable to determine the TP at the end:

1698278237287.png


I have a conditional branch that basically checks if TP_Battle Start >= TP_Battle End. If it is... nothing. Otherwise, I want the engine to calculate how much greater it is and basically subtract that, ensuring the player ends combat with the same TP they started with. That's what I can't figure out.

Any help? Or am I going about this the wrong way and maybe I should try something else? Thanks in advance 🙂
you wont need the second variable. do what you did where you store the pre battle tp to a variable, and then at the end, remove the conditional check and use
Code:
 $gameActors.actor(1).setTp($gameVariables.value(72))
to revert it
Is there some reason you're using the Script field instead of Game Data -> Actor -> TP?
[Edit: never mind, this thread is for MV.]

Even without scripting, I think you only need 1 variable per actor: end + (start - end) = start.
  1. On battle start, set variable equal to TP (variable value is now start).
  2. On battle end, subtract TP from variable (variable value is now start - end).
  3. Then Change TP -> Increase -> Variable.
Is there some reason you're using the Script field instead of Game Data -> Actor -> TP?

Even without scripting, I think you only need 1 variable per actor: end + (start - end) = start.
  1. On battle start, set variable equal to TP (variable value is now start).
  2. On battle end, subtract TP from variable (variable value is now start - end).
  3. Then Change TP -> Increase -> Variable.
This is what I wanted to do, but TP isn't an option under Game Data / Actor:

1698280262144.png
Oh right, I forgot that isn't an option in MV (it is in MZ). 😴
you wont need the second variable. do what you did where you store the pre battle tp to a variable, and then at the end, remove the conditional check and use
Code:
 $gameActors.actor(1).setTp($gameVariables.value(72))
to revert it
This worked great! Doing exactly what I wanted. Thank you! 😂

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/tp-variable-calculation.162400/