MV Get actor YEPClassChangeCore and YEPSubclass levels?


I'm using both of these plugins for my project and was unable to figure out how to check an actor's level in a particular class where it pertains to Yanfly's class/subclass plugins? I am essentially looking to use the actor's level in their current subclass inside a conditional for an event to check if they are at or above a certain level, but I can only find in the online script calls how to get the current actor's level (just main class). I searched around for a Yanfly script call list and found nothing. Thanks in advance for any assistance!
i cant check right now, but the function should be
Code:
actor.classLevel(x);
where x is the id of the class
The function is Game_Actor.classLevel(ID). How you get the actor depends on the context...if you're referencing a specific actor ID, that's $gameActors.actor(ID). You can also get there by referencing their position in the party, or if it's in a notetag you'll often have user and target and such things.

Specific syntax is difficult to give you without knowing more exactly what you're doing.

But you can use that to check their level in any class. If you want to get their level in their current class, that's actor.classLevel(actor.currentClass().id) and if you want their level in their current subclass, it's actor.classLevel(actor.actor._subclassId)
The function is Game_Actor.classLevel(ID). How you get the actor depends on the context...if you're referencing a specific actor ID, that's $gameActors.actor(ID). You can also get there by referencing their position in the party, or if it's in a notetag you'll often have user and target and such things.

Specific syntax is difficult to give you without knowing more exactly what you're doing.

But you can use that to check their level in any class. If you want to get their level in their current class, that's actor.classLevel(actor.currentClass().id) and if you want their level in their current subclass, it's actor.classLevel(actor.actor._subclassId)
My end goal is to, for each party member, track the number of battles they have participated in and won (this is already handled). Supposing the goal number is 5, when a party member reaches 5 battles, their subclass will (via event) be increased by one level. This is very similar to Dragon Quest VI's vocation system in which battles won translated to ranking up your "subclass."

My goal ultimately, whether I end up just writing a little script to handle it or can do it with eventing, is to have a number of battles required for each rank (reach level 2 after 5 battles, reach level 3 after 10 battles, etc.) and have this event check each party member for if they have reached the requisite number of battles won, which will be determined based on the current subclass level. This is where the call for subclass level helps in a conditional branch.
Okay. Then you know which actor ID you're looking for, so you can use the code I gave you.
Okay. Then you know which actor ID you're looking for, so you can use the code I gave you.
I've got to the point where I can now successfully pull every actor in the party's subclass level and increment their # of battles won based on survival. Do you know how to then increase the level of a subclass through a script? I know how to do it with a regular class, but I've tried a few different ways to format it that have not turned up any results.
Do you know how to then increase the level of a subclass through a script? I know how to do it with a regular class
There's no difference. A subclass is still a class, it's just "equipped in a different slot," if you will. As you saw above, class levels are stored by ID, there's no differentiation between class and subclass.

I've tried a few different ways to format it that have not turned up any results.
Can't tell you what's wrong without you showing your work.
There's no difference. A subclass is still a class, it's just "equipped in a different slot," if you will. As you saw above, class levels are stored by ID, there's no differentiation between class and subclass.


Can't tell you what's wrong without you showing your work.
I have called the subclass level of a given party member (in this case, the one in the first slot) using the script:

$gameParty.members()[0].classLevel($gameParty.members()[0]._subclassId)

The above code is also the full version of the line is highlighted in my below image.

I can also compare the amount of battles won (another stored variable) against an array of "thresholds" for leveling up the subclass, but my confusion about leveling a "subclass" comes from the fact that the RPGMaker MV script call for changing level doesn't hinge on ID or have a place for it in the function.

Essentially, I am unsure of how to change the level of a ClassChangeCore class as opposed to changing the level of an actor.

1730180038927.png


Other extremely likely problems with this code aside, it is working currently in the ways I need it to, minus the capability to increase the subclass's level because I'm just unclear on the syntax for changing the level rather than just checking it. Variable 58 is just a number i'm using to store the reference to the current actor in the loop.
minus the capability to increase the subclass's level because I'm just unclear on the syntax for changing the level rather than just checking it
the thing is, yanfly's class change plugin does alter the process a bit.
level is usually a property set on the actor and increases as they level up, but iirc, if youre using the setting where each class has its own levels, then both the class change and the subclass plugins remove all internal use for that property in favor of looking at your exp and calculating where your level should be instead.
you might have to do something like this to level them where you just set their exp according to the level
Code:
var a = $gameActors.actor(1);
a._exp[a._subclassId] = a.expForLevel(a.classLevel(a.subclassId) + 1)
the thing is, yanfly's class change plugin does alter the process a bit.
level is usually a property set on the actor and increases as they level up, but iirc, if youre using the setting where each class has its own levels, then both the class change and the subclass plugins remove all internal use for that property in favor of looking at your exp and calculating where your level should be instead.
you might have to do something like this to level them where you just set their exp according to the level
Code:
var a = $gameActors.actor(1);
a._exp[a._subclassId] = a.expForLevel(a.classLevel(a.subclassId) + 1)
Interestingly, running that code works to change the level, but it puts the level from 1 to 3 (and from 3 to 6 when I rerun it within the same encounter). I tried removing the +1 but then absolutely no experience is added!

The exact value added here is 366 EXP - coincidentally the "total" required to reach level 4 in the user's BASE class, but that XP is being applied to the subclass instead.

EDIT: Yes, with some more testing (and trying nextRequiredExp, instead of expForLevel) it is clearly pulling requisite EXP values to level up from the actor's base class, not the subclass. I'm still not sure of the exact way to grab from the subclass so I've appreciated the assistance, all.
Interestingly, running that code works to change the level, but it puts the level from 1 to 3 (and from 3 to 6 when I rerun it within the same encounter).
EDIT: Yes, with some more testing (and trying nextRequiredExp, instead of expForLevel) it is clearly pulling requisite EXP values to level up from the actor's base class, not the subclass. I'm still not sure of the exact way to grab from the subclass so I've appreciated the assistance, all.
riiight. what i wrote assumes the exp requirement for all your classes are the same. if your main class requires more exp per level than the subclass, then the subclass will level more. there doesnt seem to be an expForLevel() for the sublclass, and im not sure if the plugin correctly uses it for the subclass either with that in mind now that i look at it. if having all your classes use the same exp curves isnt an option, then i believe a patch will have to be made.

I tried removing the +1 but then absolutely no experience is added!
the +1 isnt for modifying the exp gained, its for getting the exp for the next level. so instead of setting your exp to the minimum required for the next level, you go to the minimum needed for your current level.
riiight. what i wrote assumes the exp requirement for all your classes are the same. if your main class requires more exp per level than the subclass, then the subclass will level more. there doesnt seem to be an expForLevel() for the sublclass, and im not sure if the plugin correctly uses it for the subclass either with that in mind now that i look at it. if having all your classes use the same exp curves isnt an option, then i believe a patch will have to be made.


the +1 isnt for modifying the exp gained, its for getting the exp for the next level. so instead of setting your exp to the minimum required for the next level, you go to the minimum needed for your current level.
I've made all classes have the same EXP curve and this is working very smoothly (and I've made it modular enough it'll work for every living party member!), so thank you very much! The last thing I am looking for is if you know how to get the name of the current subclass. My current code to (try to) get that name is this:

actor.currentClass(actor._subclassId).name

Which is at least returning the actor's MAIN class name, but it's not seeming to get the id of the subclass like the prior code did in order to get the level of the same subclass. I'm thinking currentClass might not be the way to go to acquire the name of the subclass, since it's only going to hit the regular "primary" class as in regular RMMV.
actor.currentClass(actor._subclassId).name
that function will only grab the actor's main class. nothing you pass it will make it get the subclass. if you want the subclass, use actor.subclass().name
that function will only grab the actor's main class. nothing you pass it will make it get the subclass. if you want the subclass, use actor.subclass().name
1730216990692.png

1730217025111.png

Yourself and Turan have helped me immensely! This is working perfectly and can be used for any party member with any vocation. Thank you so much!
it is clearly pulling requisite EXP values to level up from the actor's base class, not the subclass.
there doesnt seem to be an expForLevel() for the sublclass
I have a fix for that in my tweaks thread in my signature - see "Class Change Core Level Calculation". It fixes the method so passing in the subclass ID like fable did above will work as expected.

Original thread: https://forums.rpgmakerweb.com/threads/get-actor-yepclasschangecore-and-yepsubclass-levels.172886/