How to make state cost TP to maintain state

Hello everyone!
I need help with making a special state.

The state "Fire Aura" is supposed to work this way:

The user uses the skill that gives the user the state "Fire Aura".
Fire Aura gives the user a bunch of fire themed skills and the fire element.
Each turn the user has to pay 15 TP to maintain the sate.
Once the User doesnt have enough TP the User loses the state.

Here is what I need help with:

  1. How to make the state cost 15 TP each turn.
I know how to make it cost a set percentage each turn, but I need it to cost exactly 15 TP.

2. How to make the user lose the state if doesnt have enough TP


I hope you can help me!
Hello everyone!
I need help with making a special state.

The state "Fire Aura" is supposed to work this way:

The user uses the skill that gives the user the state "Fire Aura".
Fire Aura gives the user a bunch of fire themed skills and the fire element.
Each turn the user has to pay 15 TP to maintain the sate.
Once the User doesnt have enough TP the User loses the state.

Here is what I need help with:

  1. How to make the state cost 15 TP each turn.
I know how to make it cost a set percentage each turn, but I need it to cost exactly 15 TP.

2. How to make the user lose the state if doesnt have enough TP


I hope you can help me!
You will need Yanfly's Buffs & State core: http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
paste this into the State's notebox
<Custom Turn Start Effect>
if (target.tp >= 15) {
target.gainTp(-15);
} else {
target.removeState(x);
}
</Custom Turn Start Effect>

x is the Id of this state
Thank you, works perfectly!
@Isabella Ava Du you happen to know how to add that an animation plays when the state is removed?
Below "target.removeState(x);", add "target.startAnimation(x);" with X is your animation ID.
Perfect, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-state-cost-tp-to-maintain-state.91908/