Status
Not open for further replies.

jjleroy

I love bananas
Veteran
Joined
Aug 5, 2017
Messages
184
Reaction score
34
First Language
German, English
Primarily Uses
RMMV
Hey guys, I'm sure a lot of you use Yanfly's Class Change Core plugin which gives actors multiple classes.

Now I'm trying to figure out a way how to get the level of an unlocked, but currently inactive class.


I can only get the amount of experience of that class by using:

Code:
$gameActors.actor(1)._exp[classId]

And I can check if the actor has the class unlocked:

Code:
$gameActors.actor(1)._unlockedClasses.contains(classId)

But I would need to get the script call for the level of each unlocked class an actor has, and store it in a variable...


Anyone know how to do this? In the plugin, I found the following, but I still can't seem to figure it out:

Code:
Game_Actor.prototype.checkLevelUnlockedClasses = function() {
    for (var i = 0; i < $dataClasses.length; ++i) {
      var item = $dataClasses[i];
      if (!item) continue;
      if (this._unlockedClasses.contains(item.id)) continue;
      if (Yanfly.Util.isEmptyObj(item.levelUnlockRequirements)) continue;
      if (!this.classUnlockLevelRequirementsMet(item)) continue;
      this.unlockClass(item.id);
    }
};

Game_Actor.prototype.classUnlockLevelRequirementsMet = function(item) {
    var classId;
    for (classId in item.levelUnlockRequirements) {
      var level = item.levelUnlockRequirements[classId];
      if (this.classLevel(classId) < level) return false;
    }
    return true;
};

Window_ClassList.prototype.drawClassLevel = function(item, x, y, width) {
    var level = Yanfly.Util.toGroup(this._actor.classLevel(item.id));
    var fmt = Yanfly.Param.CCCLvFmt;
    var text = fmt.format(level);
    this.resetFontSettings();
    this.changeTextColor(this.normalColor());
    this.contents.fontSize = Yanfly.Param.CCCLvFontSize;
    this.drawText(text, x, y, width, 'right');
};


EDIT: Wow, I figured it out just after posting the thread.

The solution was

$gameActors.actor(1).classLevel(classId)

I simply had a typo so that's why it wouldn't want to work.
 
Last edited:

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,018
Reaction score
5,903
First Language
Dutch
Primarily Uses
RMXP

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.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

New profile picture! This time, it's representative of my current project.
I suddenly feel like making a game for little kids: a pointless sandbox of cute animals, silly collectibles, and random mini games.
Anyone else just like, not bother to make games themed around specific holidays? I know I won't get them done in time for it to make sense.
time to enter the playtest dimension
Sherriff: This permit you're renewing expired two months ago, you haven't been concealing illegally have you?

Me, remembering the sheriff was at the range with me a couple weeks ago and unsure if he'd noted me draw from IWB: I plead the fifth.

Forum statistics

Threads
115,987
Messages
1,094,668
Members
151,275
Latest member
akrrkvkakrrkvk2
Top