MV Changing emoset using conditions

Hi!

I'm making a game where there are several alternative missions that can be done at any time, but in the middle of the game the main character (John) changes to another one (Mark) and then the player can control this new protagonist and do the same missions.

The problem is that in these missions there are dialogues where the current main character speaks.

I have 2 emosets files for both main characters, luckily each face matches the same index as the other character, for example:

If the main character "John" has a dialogue using the file "John2.png", index 3,
when the second character "Mark" speaks in this same dialog he should use the file "Mark2.png", index 3.

To do this I put a lot of "if{}else", asking for the main character in the party, but it's a lot of dialogs, so I'm here to ask for help.

I imagine a script capable of toggling files when they are called using a condition, for example for the previous case:

When a dialog uses the "John.png" file and Mark is in the party, then use the "Mark.png" file instead.
When a dialog uses the "John2.png" file and Mark is in the party, then use the "Mark2.png" file instead.

Do you know any way to do it?

Original thread: https://forums.rpgmakerweb.com/threads/changing-emoset-using-conditions.159156/