Turn off TP regeneration for a state

With a certain state, I don't want TP to regenerate from enemy attacks, but it still allows regeneration from a skill's TP gain. How can I do this? Making TRG -100 doesn't work properly, because once the state wears off, they lose TP for some reason.
You'll need a script to turn off the TP from enemy attacks. Plus, you will need to clarify what you mean by skills TP gain, as by default the only ways to gain TP are take damage or the random boost given at the start of the battle.


I've moved this thread to RGSSx Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
I meant this kind of TP gain:


tumblr_inline_oju8y6i9fN1rtomod_540.png
Ok. You'll still need a script to disable the random part of the gain, as well as the pre battle gain (if you don't want that as well). No idea if one exists for it yet though, but if you know a little scripting I believe it is pretty short to write (as you need to overwrite two lines of code or so).
Disabling pre-battle gain won't be necessary because this state is single turn. And unfortunately I know next to nothing about scripting.
Oh, you want to do it with a state only? That is going to be more complicated, as now you'll have to overwrite totally how TP gain is handled. Otherwise, it would be as simple as adding a tp rate 0% to the state.


Afraid you'll now have to wait for someone to write this script, and it is not quite as easy as it will have to distinguish when a state is on and when it is not (and it will have to tell which state too).
Just add another feature for the state, it's the TCR (TP Charge Rate) Sp-Parameter feature, set it to 0%.


TRG and TCR is not the same.


TRG is TP Regeneration Rate. Regeneration happens after each turn. Negative values will reduce TP at the end of a turn, positives will increase it.


TCR is TP Charge Rate. TP charge happens when you take damage and when you use a skill with a positive TP Gain set up for it.


This all assumes that you use the default TP system, and not a custom one (such as Yanfly's TP System, for example).
I just tried that and it prevents TP gained from taking hits like I wanted, but it also prevents TP from going up from TP gain.


This is a special Counter skill that I made using this script. It uses up TP for usage, but I found gaining TP through enemy attacks while countering is pretty broken because he gets his TP all back easily if he keeps getting attacked, which means he can just spam this counter as if it had no cost at all. but I still want the reaction skill to give him TP back upon a successful counter. It's confusing, I know.


However, because I don't want to add another script just for this, since I can't see this being used for any other purpose besides this one skill, I suppose I'll leave it as he cannot gain TP at all while countering, it's better than nothing. This is fine, thank you.
So let me get this straight:  A state will make sure 0 TP is gained only from enemy attacks.   Assuming this is the only source you want to affect, I think there's one area that only needs to be modded:


class Game_Battler < Game_BattlerBase

def charge_tp_by_damage(damage_rate)
self.tp += 50 * damage_rate * tcr if !self.state?(NOTPFROMENEMYATTACKS)
end

end


The default method was aptly named, so pretty much if you don't want that tp to increase, just don't run it if you have the state.  Of course, you would have to replace NOTPFROMENEMYATTACKS with the id of your state.
@harosata Sorry for being incompetent, is that a snippet script I need to add in, or do I need to overwrite an existing base game script?
@HopeFragment


Always, always, always, put new scripts/snippets into new slots in the Scripts window.. Never, never, never directly modify the base scripts. This is for your own safety. 🙂
@Engr. Adiktuzmiko Alright, I wasn't sure because I have seen people say to "find so-and-so line in Game_[whatever] and replace it with so-and-so" a few times on here, one solution to one of my problems in the past I looked up on here was to do that.


Either way, I tested the snippet and it works like a charm, thank you, @harosata!
Edit:  Ignore this post.  I was responding on ANOTHER topic and have no idea how it ended up on THIS topic.

Original thread: https://forums.rpgmakerweb.com/threads/turn-off-tp-regeneration-for-a-state.73664/