Halving TP at the start of each battle?

I was wondering if there's some way (with or without a plugin, either's fine) of making it so TP is preserved after each battle, but reduces by half at the start of each new battle? I.e. if you end a battle with 60 TP, you'll start the next one with 30?

Thanks in advance.
preserve TP is already a trait that can be added to any actor.

halving the TP would have to be done by a troop event running at the beginning of each battle, or by a common event at the end of every battle (in which case the halved TP would be effective immediatly after battle instead of at the beginning of the next, but that is a bit easier to do)
preserve TP is already a trait that can be added to any actor.

halving the TP would have to be done by a troop event running at the beginning of each battle, or by a common event at the end of every battle (in which case the halved TP would be effective immediatly after battle instead of at the beginning of the next, but that is a bit easier to do)

Oh lol can't believe that didn't occur to me, thanks!
This is (almost) trivially easy to do with events (that isn't meant as like, a shot at you, I'm just excited that I can actually help with something even though I have almost 0 knowledge of scripting) so let me explain how. To make things even sweeter, this is a situation where doing it with events isn't really any klunkier or kludgier in my opinion than doing it with a plugin.

You want the following event "code" on an event page in the "Battle Events" of every "Troop". First change the condition for running the event from "Don't Run" to "Turn 0" and keep the "Span" on "Battle". Then input the following code:


Um...NEVERMIND, THEN! WOW it is stupid that you cannot set a variable equal to TP under the "Game Data" field in Control Variable.

@Andar: you can increase/decrease TP vis event commands but you CANNOT multiply or divide TP that way. I figured there was a workaround for this using variables and math. Namely, starting with Control Variable to set a variable equal to the Actor's TP. But that is not actually a thing RMMV can do, which is STUPID. Because if TP was in the Control Variable $GameData drop down, OP could use this exact methodology to achieve the desired effect (not pictured: rinse & repeat for each character in the party, copypasta to each battle troop).

STUPID.png

But RMMV is STUPID so someone with JavaScript is probably needed to implement this.
I have not tested this, but give the following a try, combined with the Preserve TP option. Call it halveTp.js or something like that:

Code:
Game_Battler.prototype.initTp = function() {
    this.setTp(Math.floor(this.tp / 2));
};

Now, if this works it will affect ALL battlers - actors AND enemies. If you only want it to affect actors, use this instead:

Code:
Game_Actor.prototype.initTp = function() {
    this.setTp(Math.floor(this.tp / 2));
};
I have not tested this, but give the following a try, combined with the Preserve TP option. Call it halveTp.js or something like that:

Code:
Game_Battler.prototype.initTp = function() {
    this.setTp(Math.floor(this.tp / 2));
};

Now, if this works it will affect ALL battlers - actors AND enemies. If you only want it to affect actors, use this instead:

Code:
Game_Actor.prototype.initTp = function() {
    this.setTp(Math.floor(this.tp / 2));
};

Thanks! But unfortunately I tried both of these (in new projects with no other plugins, too) but neither of them worked...
Were there any error messages? If you hit F8 when starting the game and go to the Console tab, is there anything there saying something went wrong?
This is all that came up, not sure if this helps.
1577092898439.png
that isn't the console tab.

Ugh! Please give it another go, but first REMOVE the Preserve TP option on your actors. The function I changed for you only gets run if you don't have that option.

Sorry that didn't occur to me straight away.
that isn't the console tab.

lol.
Oh I'm so sorry I'm stupid, here it is
edit: clearer picture, it's just the same request animation flow stuff further down
1577093528139.png
Please try it again, but remove the Preserve TP option on your actors.
When I remove it they just start off with 0 TP. (I'm not sure if I've misunderstood you - is there a global TP preserve option somewhere aside from just setting a trait on actors? I've been staring at the System tab and can't find anything like that) Sorry for all the trouble.
1577094360053.png
Sorry - there's something there not right. I did some mods but it still won't work for me.

Do you want this to happen for all actors and all enemies?
Just all actors is fine, but whichever is easiest is perfectly OK. Thank you!
okay, I think I've got it. Please replace the code I gave you with the following:

Code:
Game_Actor.prototype.initTp = function() {
    this.setTp(Math.floor(this.tp / 2));
};

Game_Actor.prototype.clearTp = function() {
    // this.setTp(0);
};

I realised it doesn't make sense to do this for enemies, because it's not the same enemy each time. So this will only do it for actors, and enemies will still just get a random amount.

Your actor will have 0 TP at the start of the first battle, but after that, each battle should start with half the TP they had after the previous battle.

The Preserve TP option should NOT be set on any of your actors.
Yep, that worked!! Thanks so much for all your help.
I may be sort of going off topic, but:

Um...NEVERMIND, THEN! WOW it is stupid that you cannot set a variable equal to TP under the "Game Data" field in Control Variable.
There's always the script call approach instead of game data, which is actually pretty simple. Control variables -> script box:

$gameActors.actor(1).tp

This will assign actor 1's tp to whatever variable you want.
That....is good to know! Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/halving-tp-at-the-start-of-each-battle.116526/