how to limit skill when variable changed

I want to set a variable as resource for player's skill.

I used the YEP to make the variable decrease when player cast the skill. (e.g. The variable named "DP", and a skill FIREBALL cost 10 DP)

But the question is when the DP is less than 10, I can still cast the FIREBALL, and the DP decreased to negative.

Anyone knows how to limit the skill when the variable can't afford the cost.

thanks.
Your post doesn't give any reason that the player shouldn't be able to use the skill when the variable is 0 - did you actually try anything?

You'd use the custom requirement from Yanfly Skill Core.
Code:
<Custom Requirement>
value = $gameVariables.value(X)>=10;
</Custom Requirement>

And if you want the player to know that cost, you can use the Custom Cost Display notetag.
Your post doesn't give any reason that the player shouldn't be able to use the skill when the variable is 0 - did you actually try anything?

You'd use the custom requirement from Yanfly Skill Core.
Code:
<Custom Requirement>
value = $gameVariables.value(X)>=10;
</Custom Requirement>

And if you want the player to know that cost, you can use the Custom Cost Display notetag.
ah that's what I mean, and THANKS!

I tried to use common event in the troop page, and added a branch condition to check if the variable is too low to cast skill, but I found the event only work at the end of turn. 😅

Original thread: https://forums.rpgmakerweb.com/threads/how-to-limit-skill-when-variable-changed.159508/