Help with Yanfly Class System - Check Character's Current Class

Hello,

I'm making a game in VX Ace using Yanfly's Class System and I want to have different things happen in events depending on the character's current class. Is there a way to check what class a party member is? I've looked through the script and don't see an obvious variable or function to use, though I'm not familiar with Ruby.

Thanks!
There is a default event command that can check for the actor's class.
Under Conditional Branch >> 2nd tab >> Class.

If you want to check the subclass, you will have to use a script call in Conditional Branch >> 4th tab >> Script:
Code:
# Based on party position:
# index = The position of the actor (0 - leader, 1 - second, 2 - third, and so on).
# X = The database ID of the class you want to check for.
$game_party.members[index].subclass.id == X

# Based on actor ID:
# actor_id = The database ID of the actor.
# X = The database ID of the class you want to check for.
$game_actors[actor_id].subclass.id == X
# Based on actor ID:
# actor_id = The database ID of the actor.
# X = The database ID of the class you want to check for.
$game_actors[actor_id].subclass.id == X[/CODE]

Unfortunately, the game will crash with a NoMethodError error if the specified actor_id doesn't presently have a subclass set. Might there be a workaround for this?

Incidentally, thank you for sharing this code. I wasn't able to find this function referenced in the Yanfly Class System script.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-yanfly-class-system-check-characters-current-class.100396/