MV [SOLVED]Yanfly Enhanced TP Help - Switching modes...?

Yo!
So I'm using the Enhanced TP and a variety of other plugins. What I want is when the enemy is afflicted with a certain state, they do not gain any TP from ANY source.

So I thought, hm, well I'll just have the enemy switch TP Modes to a mode with everything set to zero whilst the state is active, then switch back when it's not, using: battler.setTpMode(1); and battler.setTpMode(2); in the <Custom Apply Effect> and <Custom Remove Effect> respectively.

However... that doesn't seem to work, and the enemy still gains TP when I clap its cheeks.

So I tried inserting those battler.setTpMode lines amongst the code I have in the state's notetag box... nope, still not working.

Anyone got any other suggestions? I also tried setting TP Charge Rate * 0 in the state params but, nope.

TL;DR: I want the enemy to gain TP from being attacked until it gains a certain state (I have done this bit already). Whilst the state is active, it does not gain TP from any source (this i cannot seem to achieve). HELP!
Do you have that mode locked by default in the plugin parameters (so that players can't choose it)?

If so, you'll need to unlock it for the enemy battlers before you can set the mode. You can do that via a notetag on each enemy, or by doing battler.unlockTpMode() before you call setTpMode().
Do you have that mode locked by default in the plugin parameters (so that players can't choose it)?

If so, you'll need to unlock it for the enemy battlers before you can set the mode. You can do that via a notetag on each enemy, or by doing battler.unlockTpMode() before you call setTpMode().
Hey dude. No, it's not locked. I'm starting to wonder whether switching TP modes is even possible in the middle of battle...
Hey! So I managed to solve it. Here's the solution for anyone who might have a similar problem!
In the "Take HP DMG" box, I noticed beneath it says it is a "formula".

So I typed in:
if (!user._YourStateName) { (YourDamageFormulaHere) } else { (OtherDamageFormula) }

And it worked perfectly.
Hey dude. No, it's not locked. I'm starting to wonder whether switching TP modes is even possible in the middle of battle...
I don't see a reason battle would make a difference. Just to clarify, when you say it's not locked, you have this mode listed in the plugin parameter labeled "Default Unlocks"? Because if it's not unlocked...it's locked. All modes are locked by default.
I don't see a reason battle would make a difference. Just to clarify, when you say it's not locked, you have this mode listed in the plugin parameter labeled "Default Unlocks"? Because if it's not unlocked...it's locked. All modes are locked by default.
Yes. But it's okay I solved my issue anyway!

Original thread: https://forums.rpgmakerweb.com/threads/solved-yanfly-enhanced-tp-help-switching-modes.144448/