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
193
Reaction score
125
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,005
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)?
 

Latest Threads

Latest Posts

Latest Profile Posts

I wish character bust packs had options for both side-facing and front-facing for the same characters.
Looks like I'm going to have to cancel another game.
For now it is in testing phase: Changing the game icon from Rm2k/2k3 without needing to edit the executable.
Rm2k-DinChangeIcon.png
When there's a will, there's a lifehack. :ninja:

Before i mess with battle UI further, does it look decent enough? :hswt:

Forum statistics

Threads
112,528
Messages
1,068,980
Members
146,216
Latest member
WTCraft2003
Top