Checking party member's class and level

Hello, everyone! I wanted to know if you could help me with something I've been trying to do for a long time (and that is stopping me from continuing with my game)

So basically I made an NPC which is a witch. When you interact with this NPC, she asks you who is going to talk to her. So 5 message options pop up (one for each party member and one for cancelling the interaction). Up to there everything's fine because I know how to configure every option to show the name of the party member in that specific slot (\p[0,1,2,3]). But then, when you choose a party member I want the witch to check it's level and class and sell items according to that. Is it possible? I'm using a system in which the party members can be exchanged whenever you want.

Thanks in advance!!!
Something like this, in a script call, would put the level of the first party member (the leader) into variable 1, and their class id into variable 2:

Code:
var actor = $gameParty.members(0);
$gameVariables.setValue(1, actor.level);
$gameVariables.setValue(2, actor._classId);

If you wanted to make it more flexible, by using variable 2 for the party member number (so in the show choices actions, you'd just set variable 2 to 0, 1, 2, 3, etc), you'd put $gameParty.members($gameVariables.value(2)) instead of $gameParty.members(0). That means you wouldn't have to duplicate the script for all of them.
Tried what you said and tested it in a message with the \v[x] command it returns a value of 0.
within the script option of your conditional event command:
Code:
$gameParty.members()[party member index].level >= min level && $gameParty.members()[party member index].isClass($dataClasses[classId]);
this is explicit specification and will need to be repeated using the appropriate data for each instance of the shop.
I'll try to test it. Thanks for replying

Original thread: https://forums.rpgmakerweb.com/threads/checking-party-members-class-and-level.88068/