MV Help with Yanfly's Skill Learn Plugin? Trying to do a custom skill cost where the cost is lower if the actor knows a skill/skills.

So I'm trying to use the Skill Learn plugin along with the JP Plugin, and it works fine, but I'm I'm stuck on how to do a custom skill cost.

What I'm doing is a basic Job system, the player can learn a variety of skills in each job, for example;

Lower Encounters - 5 JP
Poison Immunity - 5 JP
First Aid - 5 JP

Then there's another skill;

Increase Job Level - 50 JP

Learning this skill unlocks the next set of skills for the Job, which have their own costs.
What I'm trying to do is lower the JP cost of 'Increase Job Level' if one or more of the other skills are learned, so if the player learns 'Lower Encounters', 'Increase Job Level' should have it's cost reduced.

Like this;

Lower Encounters - Learned
Poison Immunity - 5 JP
First Aid - 5 JP

Increase Job Level - 47 JP

And if multiple skills are learned, it should drop further, for example;

Lower Encounters - Learned
Poison Immunity - Learned
First Aid - 5 JP

Increase Job Level - 44 JP

Does anyone know a way to do this? It should be noted that any character in the party can use any job.

I've moved this thread to JavaScript/Plugin Support. Thank you.

(You originally posted this in MV Support, but plugin/scripting stuff has its own areas here.)

Plugin link for ease of reference:
Maybe try something like this:

<Custom Learn JP Cost> cost = 50; if (user.isLearnedSkill(10)) cost -= 3; if (user.isLearnedSkill(11)) cost -= 3; // etc </Custom Learn JP Cost>
I.e.
  • Start at cost = 50.
  • If skill ID 10 has been learned: -3 to cost.
  • If skill ID 11 has been learned: -3 to cost.
  • Etc
Alternatively, if all those skills apply the same deduction:

<Custom Learn JP Cost> cost = 50; for (var i of [10, 11, 12, 13, 14]) { if (user.isLearnedSkill(i)) cost -= 3; } </Custom Learn JP Cost>
I.e.
  • Start at cost = 50.
  • For each of the IDs 10, 11, 12, 13, and 14:
    • If that skill is learned: -3 to cost.
Moved to: JavaScript/Plugin Support(You originally posted this in MV Support, but plugin/scripting stuff has its own areas here.)

Plugin link for ease of reference:
Maybe try something like this:

<Custom Learn JP Cost> cost = 50; if (user.isLearnedSkill(10)) cost -= 3; if (user.isLearnedSkill(11)) cost -= 3; // etc </Custom Learn JP Cost>

I.e.
  • Start at cost = 50.
  • If skill ID 10 has been learned: -3 to cost.
  • If skill ID 11 has been learned: -3 to cost.
  • Etc
Alternatively, if all those skills apply the same deduction:

<Custom Learn JP Cost> cost = 50; for (var i of [10, 11, 12, 13, 14]) { if (user.isLearnedSkill(i)) cost -= 3; } </Custom Learn JP Cost>

I.e.
  • Start at cost = 50.
  • For each of the IDs 10, 11, 12, 13, and 14:
    • If that skill is learned: -3 to cost.
Hey, this worked perfectly! I know enough about coding that in retrospect, it actually seems kind of obvious now that I'm awake a little, but I still had no idea how to check if the Actor knew the skill.

I appreciate the help.

(And sorry, I saw another plugin help request in there, or what looked like one since it mentioned Visustella, so I just assumed I had the right place with that and MV. I seem to make this mistake a lot though, so still, I'm sorry for the trouble.)
Great, you're welcome!

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

And no worries: lots of threads get moved, it's not a big deal. We're just trying to keep things organised~

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanflys-skill-learn-plugin-trying-to-do-a-custom-skill-cost-where-the-cost-is-lower-if-the-actor-knows-a-skill-skills.147657/