Hiding specific classes in Yanfly Change Class Core

jbstuff

Villager
Member
Joined
May 21, 2012
Messages
5
Reaction score
3
First Language
English
Primarily Uses
I am using Yanfly's Class Change Core (link here) and Yanfly's Subclass addon (link here).

Having looked around I haven't found many answers to this particular question, namely, how to hide a specific class (or classes from showing up under the class list in Yanfly's Class Plugins.

Effectively: There is a subclass that the player will never be able to change, it will be used in the background but shouldn't be visible to the player. To affect this I know how to remove the Subclass menu, and to designate certain classes as either "Primary Only" or "Subclass Only". The issue, however, is that all unlocked classes will be displayed.

In the spoiler below I've taken a screen grab showing the class I would like to be hidden from the display list (marked with the arrow).

classScene.PNG

Looking at the code for Yanfly's Class Change Core plugin my suspicion is that what I need to fiddle with can be found beginning at line 1081 under the makeItemlist.

Code:
Window_ClassList.prototype.makeItemList = function() {
    if (this._actor) {
        var data = this._actor.unlockedClasses().slice();
    } else {
        var data = [];
    }
    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 });
};
I'm not a coder, but I have over the years found myself able to fiddle with parts of code to get desired results. Here, however, I feel pretty stumped.

My intuition would be to somehow tell the plugin to ignore certain classes by their ID. I attempted to add "&& !this.classID = 1" (class ID 1 in the Database is the class I am trying to hide in my project) to line 1090, however this resulted in the Class Change menu being completely inaccessible either through the Menu or by evented Plugin Command. To be fair I was basically throwing throwing darts blindly.

I would be absolutely happy as a pickle if one of you fine and wizened individuals might be able to help point me in the right direction.

I would be more than happy to provide extra details if that's important, or be open to alternative and/or out of the box solutions to my problem.

Thank you.
 

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
161
Reaction score
102
First Language
English
Primarily Uses
You're close.

I'll provide some context you might be missing. The object "$dataClasses" is generated directly from the Classes.json file (the file that stores your Classes settings in the Database) and whenever any code pulls info from the game's Database, it pulls it from the $dataXXX. So you can basically consider any reference to it to be a reference to stuff in your game Database.

Meanwhile the "this" keyword reflexively refers to the object performing the current function (in this case, Window_ClassList). And in any Window object, the "_data" variable/property gets used to store the menu options it displays (which can be whole objects like Items or Skills or, in this case, just numbers representing Class IDs).

(Although bear in mind, the actual displaying is done by some other function (like "drawItem"/"drawAllItems"/etc.) that ultimately uses drawText to print the text and the reason you see ultimately the Class names instead of their IDs in-game is because somewhere along the line in those functions, it uses the IDs to look up the name to print.)

So this:
Code:
if ($dataClasses[classId] && !this._data.contains(classId)) { ... }
Means "if an entry exists in the Database corresponding to the provided classID index number (i.e. the list isn't shorter than that; remember a blank Class entry, even nameless, can still count as a valid Class) and the Window_ClassList's "_data" list of options doesn't already contain that number then do ....". (With the thing to do being to add the number to the list, in this case).

Hope that helps.

EDIT: Also, remember that you need to use double equals ("==") in an if-statement. A single "=" is for setting a variable to some value.
 
Last edited:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
The issue, however, is that all unlocked classes will be displayed.
Since you said this class will only be used in the background, why not just "lock" it (or dont unlock it)?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:

Forum statistics

Threads
105,855
Messages
1,017,007
Members
137,563
Latest member
MinyakaAeon
Top