Stop TP gain from spells used on menu screen

Hi all,

Been trying to work out a way to do this, but haven't been too successful thus far. Pretty simple, really: All I'm looking to do is make it so that a spell that would normally cause the users TP to be gained while in battle, does not increase the users TP when it is used outside of battle.

Ideal use scenario: User heals another character while in battle - user gains 10TP. Battle ends, player goes to menu screen and uses heal on another character, but does not the 10TP they usually would.

Currently, the system allows the user to be able to spam heal outside of battle and charge their TP meter. I would like to avoid this sort of mechanic abuse, but would also like to retain the ability to heal outside of battle.

I'm sure this probably isn't too complex, but would appreciate some help on this. Thanks in advance.
If you're using Yanfly's Skill Core, set the skill's TP gain in the editor to 0 and use this notetag:

Code:
<After Eval>
var tpGain = 10; // How much TP tp gain
if ($gameParty.inBattle()) user.gainTp(tpGain);
</After Eval>
if that above doesn't help, you need to tell us which way you used to make the actors hold TP outside the battle - have all your actors the trait "preserve TP" or what, because without that trait and by default, TP is randomly set at each battlestart and this problem isn't even there.
If you're using Yanfly's Skill Core, set the skill's TP gain in the editor to 0 and use this notetag:

Code:
<After Eval>
var tpGain = 10; // How much TP tp gain
if ($gameParty.inBattle()) user.gainTp(tpGain);
</After Eval>

Absolutely perfect, works a charm, thanks mate.

Sorry Andar, should've mentioned that I was using Preserve TP in my original post.

Original thread: https://forums.rpgmakerweb.com/threads/stop-tp-gain-from-spells-used-on-menu-screen.82081/