Any Way to Track the Total Level of all a Character's Classes?

Trying to create a system where a character gains skills based on the combined level of all classes. The issue I'm having is finding a way to store that value internally. I've tried using a variable to track the levels, but it only tracks the current level and not the overall levels gained. Is there a way to track the levels of all classes and add them together internally?

I'm currently using Yanfly Class Change Core for the different classes.
you'd have loop to get the levels for each using the actor's exp gained in each class. since youre already using yanfly's class change core though, it cuts most of the work. the script to check would be something like this
Code:
var actor = $gameParty.members()[0];
actor.unlockedClasses().reduce((a,b) => actor.classLevel(b) + a, 0)
and from there you can store the value into a variable or whatever you need to do with it to make it usable
you'd have loop to get the levels for each using the actor's exp gained in each class. since youre already using yanfly's class change core though, it cuts most of the work. the script to check would be something like this
Code:
var actor = $gameParty.members()[0];
actor.unlockedClasses().reduce((a,b) => actor.classLevel(b) + a, 0)
and from there you can store the value into a variable or whatever you need to do with it to make it usable
Could you explain how I'm supposed to implement the code you gave? I've been using a parallel common event for getting the levels so far, so I've got no idea how to properly use that code.
Could you explain how I'm supposed to implement the code you gave?
you could make it one line and put it into the script section of a control variables event command. then you'd just replace the 0 in $gameParty.members()[0]; with the index for the party member or use the script call to get a particular actor. thatll put it into a variable to use

I've been using a parallel common event for getting the levels so far, so I've got no idea how to properly use that code.
i do not suggest this. id only set the variable when it needs to be used rather than all the time. If you only use the variable in a few places, itd be much more efficient updating within those places.

Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-track-the-total-level-of-all-a-characters-classes.182263/