Shows face in shared common events

Hi guys

Is there a way or code to show the face of NPC in the common event ?

For example, common event showing text "XXX" was used for NPC A and NPC B

How can I show the face of NPC A and NPC B in this common event

Thanks
What do you mean exactly? Cause you can just select a face image in a common event Show Text but I don't think you mean that.
You can do conditions. If npc a is talking, show text with face of npc a. same for npc b. How you will manage that condition is sorta difficult. Why not just show text from the npc event?
So NPC A and B are different faces. How can we show content in common events but use their own NPC faces

For example, common events saying "Good morning, XX" but can be reused for every NPC. I know the easiest way is to manual show text for each NPC.

I think condition controlling If npc a is talking, show text with face of npc a. may work but how can we show face and common event in the same line of code ?

Is there a code to show face or NPC and common events at the same time ?
I don't know exactly how that would need to be solved, but I do know that would be even more work since you would need to link every image to an event number or set variable from within the event.

And quoting an event numbers' name works like this: \n<Bruce>\N[1] and I will come with you.

where the \ is the starting point. N calls for the actor list. I do think it's possible to directly quote an events' name but I don't know the code for that.
After a quick search I found this:
$gameMessage.setFaceImage('Actor1',0)
$gameMessage.setBackground(1)
$gameMessage.setPositionType(1)
$gameMessage.add("Show Text Script Call")
These are script calls you can run in your common event.
What I have in mind is that, replace the index with this.eventId()
This will insert the id of your event in place of index and show the face of that event.
You can do this for 8 faces. Indexes 0-7.
But this won't work if your event id is greater than 7.
All of this is a lot of work so you should just show text the normal way, from events directly.
You would need to know how to script to do this, but you can make an array of all NPCs in the game with a face name and face index then use $gameMessage.setFaceImage(array[mapId, eventId].faceName, array[mapId, eventId].faceIndex), probably would need to edit the function that shows text with that. Too complicated for anyone to make a plugin for you for as you need to manually setup an array with the information.
I think this is the best way, if you wanna do this from common events:
in the npc event, do this:
$gameVariables.setValue(x, "fileName")
Call common event

in common events:
$gameMessage.setFaceImage($gameVariables.value(x),0)
$gameMessage.setBackground(1)
$gameMessage.setPositionType(1)
$gameMessage.add("Show Text Script Call")

If you have to change index for each npc, just set a value to another variable and do this:
$gameMessage.setFaceImage($gameVariables.value(x), $gameVariables.value(x2)

Original thread: https://forums.rpgmakerweb.com/threads/shows-face-in-shared-common-events.119949/