MV An ability only usable at a specific TP value?

Hi folks. I'm scratching my head figuring out how to make an ability where the user can only activate it when they have 5 or less TP. It will give the user 50 tp in return. The move is similar to Meditate from the Final Fantasy series, except it can only be used under this condition. I have Yanfly Skill Core and tried fiddling around with the Custom Show Eval, but nothing seems to work. I tried this but am guessing there needs to be more:

<Custom Show Eval>
if (user.tp <= 5 {
condition = true;
} else {
condition = false;
}
</Custom Show Eval>

Any help would be appreciated. Thank you! 🙂
You're missing a bracket in your show condition, but you can condense this down anyway:

JavaScript:
<Custom Show Eval>
  condition = user.tp <= 5;
</Custom Show Eval>
Thanks for the reply. It still doesn't seem to work with what you posted, at least when I battle test. Also tried it with this:

<Custom Show Eval>
if (user.tp <= 5) {
condition = true;
} else {
condition = false;
}
</Custom Show Eval>
Thanks for the reply. It still doesn't seem to work with what you posted, at least when I battle test. Also tried it with this:

<Custom Show Eval>
if (user.tp <= 5) {
condition = true;
} else {
condition = false;
}
</Custom Show Eval>
If you're battle testing, have you remembered to manually save so that plugin changes are updated?
Yep, done this, but still isn't working. Meditate shows up and can be used repeatedly no matter the TP.
Looks like an issue with my version and/or plugins. I made a Disintegrate move from Yanfly's list, and the MP isn't repaid when my character finishes an enemy. So, for whatever reason, the codes aren't working, although I have action sequences and other moves working as intended.

Edit: Nevermind, I got the Disintegrate move to work.

Edit2: Oh! It seems to be working now. For whatever reason it does not allow <=. I changed it to this and it works now:

<Custom Show Eval>
if (user.tp < 6) {
visible = true;
} else {
visible = false;
}
</Custom Show Eval>

Edit3: Looking back on this, the problem was using conditions instead of "visible". Also, "<=" works. I just tested it. The skill appears at 5 tp, but not 6. This is the finished code.

<Custom Show Eval>
if (user.tp <= 5) {
visible = true;
} else {
visible = false;
}
</Custom Show Eval>
Just to offer my two cents: as a player, I would not like the skill to be disappearing from my skill list when the conditions aren't met. I would want to see the skill at all times so I know it exists and what the conditions/costs to use it are.

Maybe you have specific reasons to prefer it that way, and that's okay. But if it were me, I would want the skill to be there but be disabled/greyed out, just like any other skill you can't pay the cost for. So I'd do it as:
Code:
<Custom Requirement>
value=user.tp<=5;
</Custom Requirement>

And then you can use a Custom Cost Display notetag so the player knows the exact circumstances when the skill will work.
That is a much better code, thank you! I included the requirements in
the ability description, because it doesn't use any TP to activate.
This is something I will use again in future for other similar moves.
I think we can consider this one closed! Cheers.

Original thread: https://forums.rpgmakerweb.com/threads/an-ability-only-usable-at-a-specific-tp-value.151979/