RMMV 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.

Status
Not open for further replies.

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
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.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,659
Reaction score
2,751
First Language
EN
Primarily Uses
RMMZ

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.
 

Terozu

That guy who started two years ago. (wow O:)
Veteran
Joined
Mar 3, 2019
Messages
58
Reaction score
39
First Language
English
Primarily Uses
RMMV
[move]JavaScript/Plugin Support[/move](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.)
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,659
Reaction score
2,751
First Language
EN
Primarily Uses
RMMZ
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~
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Took some trial and error, but I managed to create "visuals" for underground dig path regions.
Couldn't sleep at all so I started working on the topmost deck. I've had to make several deviations from the Imperator/Berengaria's deck-plans to accommodate MV's movement, but 100% accuracy was never my intention.
Still no name for the poor ship...:kaodes:
Screenshot-2022-06-25-053308.png
ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.

Forum statistics

Threads
123,025
Messages
1,153,499
Members
161,369
Latest member
jaycen
Top