How to automatically change the face in showtext event to macth the main actor?

Newbie here , just bought RMMZ and making my first game

At the start of the game I let player choose gender of the main character
then i change the main character face using this code
1674144667774.png

So now, after this event and. The main story start
However , if I don't know the player chose to be boy or girl
then when i want to make a showtext event which the actor speaks, how do I choose the right face?

Are there a way that the game can automatically chose the face display based on the current chosen face of the actor ?
You can use VisuStella Message Core with this text code:
Code:
\PartyFace[x]        Inserts party member x's face into the Message Window.

That will, of course, rely on you locking the chosen protagonist into position 0 in the party, which might require another plugin, but it's how I do it in my project.
You can use VisuStella Message Core with this text code:
Code:
\PartyFace[x]        Inserts party member x's face into the Message Window.

That will, of course, rely on you locking the chosen protagonist into position 0 in the party, which might require another plugin, but it's how I do it in my project.
To add to this, to make the process easier, I'd use that plug-in's macro function, then you can also use multiple faces by having \FaceIndex[x] in the command as well. Have a macro that puts \PartyFace[0]\FaceIndex[1] saved as \h1. Then you can have their second face be \PartyFace[0]\FaceIndex[2] saved as \h2.

Also, if you have more than 6 faces, it'd be better to use \ActorFace[x] since you can have multiple "actors" be for one actor's faceset (since an actor can only have one faceset attached).
Let me add another way without plug-ins. That would still answer the title question since it does not specify the use of plugin and would be helpful to those opening the thread.

You could set a variable depending on the choice made by the player at the beginning. Later you can change the face of the character for the showtext based on that variable.
You can use VisuStella Message Core with this text code:
Code:
\PartyFace[x]        Inserts party member x's face into the Message Window.

That will, of course, rely on you locking the chosen protagonist into position 0 in the party, which might require another plugin, but it's how I do it in my project.
Thankyou very much , I will look into it

To add to this, to make the process easier, I'd use that plug-in's macro function, then you can also use multiple faces by having \FaceIndex[x] in the command as well. Have a macro that puts \PartyFace[0]\FaceIndex[1] saved as \h1. Then you can have their second face be \PartyFace[0]\FaceIndex[2] saved as \h2.

Also, if you have more than 6 faces, it'd be better to use \ActorFace[x] since you can have multiple "actors" be for one actor's faceset (since an actor can only have one faceset attached).
alright, I will also try the method . thankyou so much

Let me add another way without plug-ins. That would still answer the title question since it does not specify the use of plugin and would be helpful to those opening the thread.

You could set a variable depending on the choice made by the player at the beginning. Later you can change the face of the character for the showtext based on that variable.
Ah I see. Thankyou very much sir.
Let me add another way without plug-ins.
That does work, but it definitely makes your events more convoluted throughout the game - particularly if you have more than 2 character options.

Also, just to nitpick a bit, the OP did ask for a way to make the game "automatically" do it. You manually adding conditionals for every possibility in every line of dialogue is hardly automatic 😉

I think a better non-plugin solution would be to research the appropriate JavaScript function calls for showing the text window and choosing the portrait, and use those referencing a game variable that stores which protagonist the player chose.

That has the benefit of not needing to keep the protagonist in a specific place in the party, but it has the severe downside of having to copy and paste the Script box for every time they say something for the entire game instead of using the Show Text event command.

Also, if you have more than 6 faces, it'd be better to use \ActorFace[x] since you can have multiple "actors" be for one actor's faceset (since an actor can only have one faceset attached).
Actually, I misread the OP slightly. The player isn't choosing from different actors, the images for that actor are being changed. So you can just use the \ActorFace command and the party position doesn't matter. Even easier.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-automatically-change-the-face-in-showtext-event-to-macth-the-main-actor.154243/