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

Scrutable

Warper
Member
Joined
Sep 24, 2018
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMVXA
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!
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
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
 

GreenBanana

Active Chain and Combo Input Skills plugin
Veteran
Joined
Mar 28, 2014
Messages
78
Reaction score
5
First Language
English
Primarily Uses
RMMV
# 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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top