MV Variables Included in Skill Costs.

Hello, I'm trying to figure out a way to include a specific variable as a skill cost without subtracting any value from said variable.
(I'm using Yanfly's SkillCore plugin for this.)
The idea is that the variable needs to match a specific value in order for the actor to use the skill, exactly like MP and TP, although I don't want to subtract any value from the variable upon skill use.

Example: A skill costs 30 MP and 50 VN to use. (VN = Variable Name)
The variable needs to be at a value of 50 in order for the skill to be used.
Upon using the skill, MP is subtracted from the user's Max MP but the value of the variable stays the same.

The problem is that I have no JavaScript knowledge, and so I'm not sure how to show the required value of VN in the skill cost.
Can someone please help me figure this out? Thank you!
Moved to: Plugin Support
Hi there!
I don't know how the Yanfly plugin works, but let's say you already have a way to set a variable as a cost to the skill.
I believe you can either:

1 - Set a parallel event to keep set this variable value to a fixed value.

2 - Add a common event to the skill, so that after the character uses it, this common event could restore the variable value.
Hi there!
I don't know how the Yanfly plugin works, but let's say you already have a way to set a variable as a cost to the skill.
I believe you can either:

1 - Set a parallel event to keep set this variable value to a fixed value.

2 - Add a common event to the skill, so that after the character uses it, this common event could restore the variable value.
The problem is actually setting the variable cost to a set value.
VN is meant to be a variable that evolves throughout the game along with the actor. (Although I probably should have specified this from the start.)
Every time I try to set the skill cost to a specific value, the skill cost displayed in-game is always displayed as the current value of the variable, not the intended value required to use the skill.

This is the script I'm using in the skill notetag. The skill cost in-game is supposed to show the minimum value required to use the skill.

JavaScript:
<Custom Requirement>
if ($gameVariables.value(3) > 15) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Cost Display>
\C[6]\fs[20]\v[3]VN
</Custom Cost Display>

But the problem is that in-game, the VN cost is displaying the current value of the variable at that moment, not the intended value of the skill cost. (Intended VN cost is 15NVN.)
VN Example.png


I've already figured out how to use the skill without subtracting any value from the variable. Displaying the intended cost is my main issue. Is there something that I'm missing here?
The problem is actually setting the variable cost to a set value.
VN is meant to be a variable that evolves throughout the game along with the actor. (Although I probably should have specified this from the start.)
Every time I try to set the skill cost to a specific value, the skill cost displayed in-game is always displayed as the current value of the variable, not the intended value required to use the skill.

This is the script I'm using in the skill notetag. The skill cost in-game is supposed to show the minimum value required to use the skill.

JavaScript:
<Custom Requirement>
if ($gameVariables.value(3) > 15) {
value = true;
} else {
value = false;
}
</Custom Requirement>
<Custom Cost Display>
\C[6]\fs[20]\v[3]VN
</Custom Cost Display>

But the problem is that in-game, the VN cost is displaying the current value of the variable at that moment, not the intended value of the skill cost. (Intended VN cost is 15NVN.)
View attachment 260540

I've already figured out how to use the skill without subtracting any value from the variable. Displaying the intended cost is my main issue. Is there something that I'm missing here?
Update: Managed to figure it out!
Turns out the problem was custom requirement. I was displaying the variable number in the form of text code instead of the intended skill cost.
Thank you for your time!
I know you said you managed to figure it out, but just to give you a quick tip - the code you wrote for your requirement doesn't do what you said you want.

The idea is that the variable needs to match a specific value in order for the actor to use the skill...
The variable needs to be at a value of 50 in order for the skill to be used.

What you wrote:
JavaScript:
if ($gameVariables.value(3) > 15)
will allow the actor to use the skill as soon as the variable hits 16, and for any value higher than that.

If that's what you decided you want to do, that's fine. But if you want to do what you said in your first post, and the variable needs to be at a specific value to use the skill, you'd do:
Code:
<Custom Requirement>
value = $gameVariables.value(3)==50;
</Custom Requirement>
or 15 or 16 or whatever you want that threshold to be.

Original thread: https://forums.rpgmakerweb.com/threads/variables-included-in-skill-costs.157104/