Making Skills cost gold to use.

I've been trying to create a class whose skills cost gold to use, but I'm having problems with this.


I'm using Yanfly's Skill core plugin, but since it doesn't have a preset for skills costing gold, this makes things difficult. I found little help with the skill costs items plugin either.


I figured I could try using the example formulas on yanfly's site, but I haven't had much luck with those either:


<Custom Requirement>
if ($gameParty.gold() > 100) {
value = true;
} else {
value = false;
}
</Custom Requirement>

<Custom Execution>
$gameParty.loseGold(100);
</Custom Execution>

<Cost Display Eval>
var variableId = 200;
var value = 100;
$gameVariables.setValue(200, 100);
</Cost Display Eval>

<Custom Cost Display>
\c[2]\v[200]\c[2] Gold
</Custom Cost Display>


This is what I put in the skill's notetag. I'll admit I'm not an expert at creating code, so forgive me if I'm doing something wrong. I figure I have to put something in the value= true or false section, but I'm not sure what or how to format it. This is essentially what happens:


The skill works, and the cost displays thanks to the display eval, but it doesn't actually subtract from the gold pool. I want to make a skill that costs 100 gold to use.


I put the plugins in the order recommended on yanfly's site. I've also made sure to check and see if this has been addressed before. I found nothing, but if it has then I'm sorry for repeating.


I also apologize if I'm not asking this question in the proper forum. This seemed like the correct one.
Very intersting your idea, i search a way for create a trick or a pluging for this effect ...


And use % of gold for use skill like that .


(a skill who damage enemy like coin toss of setzer in FF6 for exemple.)
I also needed this kind of plugin. I hope someone can help me.
If this were rpg maker mv I'd tell you to hit F8, type in $gameMap or $gameParty, then find in the console where the players gold is and change that. 


It's not something like $gameParty.gold() -= 1 ? 
Try this , I hope It's useful for you

View attachment SkillCostGold.js
Try this , I hope It's useful for you


View attachment 45951

Thank you for making this, however there seems to be a problem with it.


The good news is the cost is showing up properly, but whenever I try to use the skill, nothing happens. On top of this, after using a skill and then checking the battle after combat, the gold amount appears as NaN. I've pasted the cap below.

If this were rpg maker mv I'd tell you to hit F8, type in $gameMap or $gameParty, then find in the console where the players gold is and change that. 


It's not something like $gameParty.gold() -= 1 ? 

After doing so, it just tells me I have 0 gold upon starting.


I'm sorry, I'm afraid I don't understand the inquiry.

NaN.png
Sorry, i fixed it

View attachment SkillCostGold.js

Success! It's now working properly.


Thank you very much! This is quite appreciated.

Hello! First, let me thank you for creating this.

I was just wondering - if in my game gold is named something else (like yen, or milk, or water or something) - will this still work?
And if not, what can I change to make it work? Would replacing all instances of "gold" with "yen" in the .js file work?

Thank you in advance for your time.
n
Hello! First, let me thank you for creating this.

I was just wondering - if in my game gold is named something else (like yen, or milk, or water or something) - will this still work?
And if not, what can I change to make it work? Would replacing all instances of "gold" with "yen" in the .js file work?

Thank you in advance for your time.
no need to change anything, still working
n

no need to change anything, still working
Will I be able to base the amount of gold, or in my game, Gonel the skill costs off of the user's level?

Original thread: https://forums.rpgmakerweb.com/threads/making-skills-cost-gold-to-use.62732/