RMMV YEP_ClassChangeCore / YEP_SkillLearnSystem Edit

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
Plugins
--------
YEP_ClassChangeCore: http://www.yanfly.moe/wiki/Class_Change_Core_(YEP)
YEP_SkillLearnSystem: http://www.yanfly.moe/wiki/Skill_Learn_System_(YEP)

I need help on two things:

One: I want to just grey out any class instead of just hiding them if they don't meet the class change conditions. What line of code do I have to change to accomplish this?

YEP_ClassChangeCore.PNG

Two: This is an inconvenience to me. When I have the other classes available to me and want to get to "Learn Skills", I'm being forced to choose which class I want to do this under. Like if I'm in my current class, that means I should choose the skills only for that class I'm in and I prefer to do it that way.

What line of code do I need to edit to take the class selection screen away from Skill Learn? I'd really appreciate some help on this.

YEP_SkillLearnSystem.PNG
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
910
Reaction score
574
First Language
English
Primarily Uses
RMMV
Window_ClassList.prototype.makeItemList is the function that draws the class list in the class change scene. It looks like it determines which classes an actor has unlocked, and then only draws the unlocked classes. Window_ClassList.prototype.isEnabled currently returns only true, so no checks are built into that function to actually see if a class is enabled or not, so you'd need to do a similar similar check in this function as the one in the above function to see which classes are actually unlocked.

Your second request would be a lot more involved. You'd need to modify the function called when selecting the learn command to skip the class list check, and set the current class as the selected class for that window. You might also want to change the cancel function of the skill learn window to skip past the class list window as well, unless you still want to be able to learn skills from other classes, just not have the choice immediately.

With that change you'd never be able to access the ability to learn skills from a class you weren't currently using:
skills -> learn -> skill list
Without it, you could cancel out of the skill list window and access the class list and learn skills normally:
skills -> learn -> skill list -> cancel -> class list -> skill list
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
@ramza
So I have to change the code on Window_ClassList.prototype.isEnabled? I want them to show at all times, but they won't be enabled as long as I don't meet the level requirement.

I'm pretty lost on what I have to set in the code to get it on Class Change and the Skill Learn. I would try a "return false" to see something or their current class check, I'm not getting any results.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
910
Reaction score
574
First Language
English
Primarily Uses
RMMV
@RK DracoRoy
Copy the following code, paste it into a text file, and save it as something.js. No credit needed.

Code:
Window_ClassList.prototype.makeItemList = function() {
    var data = []
    for (var i = 1; i < $dataClasses.length; i++){
        data.push(i)
    }
    this._data = [];
    for (var i = 0; i < data.length; ++i) {
      var classId = data[i];
      if ($dataClasses[classId] && !this._data.contains(classId)) {
        this._data.push(classId);
      }
    }
    this._data.sort(function(a, b) { return a - b });
};

Window_ClassList.prototype.isEnabled = function(item) {
    return this._actor.unlockedClasses().slice().includes(item);
};
Import it into your plugin manager below YEP_ClassChangeCore and YEP_X_Subclasses if you have that.

This makes it so that all classes are listed on the class change window, but only the ones that the currently selected actor has unlocked will be enabled. I did this by modifying the first function I named above, to skip over the part where it checks the current actor for unlocked classes, and instead instructed it to simply list all classes. Then I changed the isEnabled function I mentioned second to reinstate that same check that it used to be doing in the first function, essentially disabling the item in the list if it is not unlocked by the current actor.

This topic probably should have been posted in requests, rather than support. Because it was framed as a support question, I thought that my describing how to solve the problem yourself would be sufficient. Had it been in the requests forum I would've opened by giving you the code instead.
I can probably also figure my way around making something for your second request as well, it'll just take a me a bit as I haven't looked into it at all.

Edit:

Here is some code for the skill learn scene. It makes the system behave more like the classchangecore plugin is not installed - meaning it only allows you to learn skills from the current class. To learn a skill from a different class, the actor needs to change classes to that class first.

Same as before, copy + paste it into a notepad and save it as a js file. You could even append it to the end of the other one. no credit needed. Load it after SkillLearnSystem or it won't do anything.

Code:
Scene_LearnSkill.prototype.adjustSelection = function() {
      this.commandClass();
      this._commandWindow.deactivate();
};

Scene_LearnSkill.prototype.onLearnCancel = function() {
      this.popScene();
};

Game_Actor.prototype.availableClasses = function() {
    return 1;
};

Window_SkillLearnCommand.prototype.makeCommandList = function() {
    if (!this._actor) return;
    this.addClassCommand(this._actor.currentClass().id);
    this._currentClass = this._actor.currentClass().id;
    return
};
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,867
Reaction score
14,522
First Language
English
Primarily Uses
RMMV

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.

 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
@ramza

It turns out with Skill Learn System that it takes into account the amount of Job Points (http://www.yanfly.moe/wiki/Job_Points_(YEP)) you had in the other class despite this edit only bypassing the class selection.

Issue2.PNG
Issue1.PNG

This means that I will be able to click a skill, due to it checking other classes I have access to, and have negative Job Points as a result.

Issue_NegativeJP.PNG

This is how the Job Points are taken into account, despite me being in the third class and not in the 2nd class with that amount. (This photo without the edit applied).

Issue_Classes_JobPoints.PNG
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
910
Reaction score
574
First Language
English
Primarily Uses
RMMV
@ramza

It turns out with Skill Learn System that it takes into account the amount of Job Points (http://www.yanfly.moe/wiki/Job_Points_(YEP)) you had in the other class despite this edit only bypassing the class selection.


This means that I will be able to click a skill, due to it checking other classes I have access to, and have negative Job Points as a result.


This is how the Job Points are taken into account, despite me being in the third class and not in the 2nd class with that amount. (This photo without the edit applied).

That seems odd, because with what I made up there, I didn't think it'd show the class list at all, so there'd have been no opportunity to somehow end up buying skills from a class to which an actor didn't currently belong.

Have you tried adjusting the load order so that the patch is below the JP plugin as well? Maybe that plugin is overwriting my overwritten changes.

In any case, your description of what's happening here is a bit confusing. I'm not sure how you're getting it to show you a skill from a class you're not currently in, so it shouldn't have a chance to check the jp requirement to buy that skill?
 

RK DracoRoy

Fire Emblem RPG Gamer
Veteran
Joined
Jun 29, 2017
Messages
308
Reaction score
97
First Language
English
Primarily Uses
RMMV
@ramza

The edit you gave does work, preventing the class list from showing. That photo with the class list shown was because I had disabled the edit earlier and to see why I'm getting negative Job Points.

I had realized without the edit, I saw why the edit to bypass the list was letting me to choose a skill despite the current class not having enough JP.

With the edit applied, even though I can bypass the class list, a skill shared between classes is going to let me choose it due to the other class having enough Job Points while the current class I'm in doesn't have enough Job Points.

It was intentional on my part on having multiple classes share the same skills, that's not the problem.

I checked the plugin order, the Job Points plugin was placed above the SkillLearnSystem (and the edit underneath it).

I'm probably sure if there was a way to have the edit check only the current class's Job Points, I shouldn't be getting negative numbers. Or let's say with Job Points, if I had changed class, take the Job Points from the previous making that 0 and give it all to the current class.

==========
Edit
==========

I hope this isn't something happening on my main project, after testing this not happening on a small project. I might investigate and see what's really going on.

=========
Edit 2
=========

It's probably something to do with JP being class-specific instead of checking just the current class's amount. Workaround to this problem was editing any line inside SkillLearnSystem containing
Code:
this.jp(classId)
into
Code:
this.jp()
 
Last edited:

Latest Threads

Latest Profile Posts

I managed to review my previous lessons on Learn MV and fixed a lot of things. Yay! :kaopride:
I've decided "Attack on Equestria" should be released first... hence this new ARG channel! https://www.youtube.com/channel/UClKiUI8xOVx9dsF4kRXUmxw
Check it out, and subscribe! The ARG will lead up to the video game. It's not a creepy game, but I just thought it should follow ARG standards.
For anyone interested in my project M - i finally made a gamethread about it :D

Forum statistics

Threads
110,409
Messages
1,053,089
Members
143,474
Latest member
Arsyloth
Top