MV Learning a class with yanfly skill learn?

Using Yanjfly's http://www.yanfly.moe/wiki/Skill_Learn_System_(YEP) which uses his job points plugin http://www.yanfly.moe/wiki/Job_Points_(YEP)

This allows a player to be able to use JP to buy skills in the game. I'm wondering if there is a javascript code that I could use to instead of having it unlock a skill, it would unlock a class instead? That way I could use his class change plugin, and basically make it a viable way to unlock classes in the game.
I'm winging some of this syntax, so let me know if it doesn't work quite properly.

Get Yanfly's Script Call Plugin Commands.

In your skill, put:
Code:
<Learn Cost Eval>
CallPluginCommand("UnlockClass " + String(user.currentClass().id) + " 1");
</Learn Cost Eval>
where the number 1 is the ID of the class you want to unlock.

I'll also mention the existence of Fox's JP Levels, which I believe gets a mention and a link from the Job Points plugin page.

It allows you to define a certain number of JP to level up in that job (separate from your regular level), and base the showing/switching into new classes on that job level. It's a threshold, rather than a cost, but it might also serve your purposes.
I'm winging some of this syntax, so let me know if it doesn't work quite properly.

Get Yanfly's Script Call Plugin Commands.

In your skill, put:
Code:
<Learn Cost Eval>
CallPluginCommand("UnlockClass " + String(user.currentClass().id) + " 1");
</Learn Cost Eval>
where the number 1 is the ID of the class you want to unlock.

I'll also mention the existence of Fox's JP Levels, which I believe gets a mention and a link from the Job Points plugin page.

It allows you to define a certain number of JP to level up in that job (separate from your regular level), and base the showing/switching into new classes on that job level. It's a threshold, rather than a cost, but it might also serve your purposes.
Unfortunately it doesn't do anything that I can tell. The fox jp levels is a great idea though, that makes what I was working on way less convoluted, although I'd still like to figure this out since unlocking classes with JP was a big part of how leveling jobs was supposed to work.

Edit: Messing around I was able to get it to work by using

<Learn Cost Eval>
CallPluginCommand('UnlockClass 5 14');
</Learn Cost Eval>

Where 5 is the class unlocking, and 14 is the class being unlocked.
I see above you are attempting to have it unlock the new class for the current class I believe. ( think this is what that is trying to do? I'm really really bad at programming)
What I need it to do is unlock the class for the current actor, not the current class.

Thanks for the help~
I see above you are attempting to have it unlock the new class for the current class I believe.
Sorry, that is in fact my mistake. It should be user.actorId() - I had classes on the brain and typed the wrong thing.
Sorry, that is in fact my mistake. It should be user.actorId() - I had classes on the brain and typed the wrong thing.
Ah okay. Tried it with this, so the code is:
CallPluginCommand("UnlockClass " + String(user.actorId().id) + " 1");

But it doesn't work. I think it's just wrong syntax.

Above what I got to work is CallPluginCommand('UnlockClass 5 14');

So the unlock class plugin comand is inbetween single ' instead of "

Looking at your code I'm guessing String is just turning the user.actorId().id literally into the number of the actor id in the code, then where the 1 is would be the class id. I just don't know javascript like at all other than what I've been messing with over the years, so I don't know why 1 is in quotes or what the +'s do
Ah okay. Tried it with this, so the code is:
CallPluginCommand("UnlockClass " + String(user.actorId().id) + " 1");

But it doesn't work. I think it's just wrong syntax.
Correct: I didn't say user.actorId().id, I just said user.actorId()

And, of course, at this point you'd be replacing the 1 with 14, judging from your next sentence.

Above what I got to work is CallPluginCommand('UnlockClass 5 14');

So the unlock class plugin comand is inbetween single ' instead of "
That doesn't make any difference in JavaScript, both single and double quotes delineate strings.

I don't know why 1 is in quotes or what the +'s do
Putting it in quotes makes it treated as a string (a sequence of letters) rather than a number. And the + sign does exactly what the plus sign always does, it adds the things together.

Original thread: https://forums.rpgmakerweb.com/threads/learning-a-class-with-yanfly-skill-learn.139836/