Using actor face graphics from database in text box? (RPG Maker VX)

Hello, I could use some help with using the actor face graphic I have set in text boxes in RPG Maker VX.

This is mainly because at the start of the game I allow the player to choose the gender they wish to play as throughout the game, and I'm having some problems when it comes to dialogue, as I show the character's face next to the text , to show the player who is saying what. The main problem with this is that there isn't an option for me to use the face graphic I've set in the database under that actor when I'm creating the text box. I realise that this could possibly be done by using switches, such as: condition: switch 0001:male is on, however as my project is very dialogue heavy with opportunities for the player to decide how to respond to parts of the plot, ideally, I don't want to have to copy and edit large portions each events just so each gender gets the correct face, as that would add a considerable amount of extra work.

Thank you.
Resource requests are for pictures and sounds, nothing else.

In your case, you'll need a messaging script to give you the options.
Moved to: RGSS2 Script Request

If I remember correctly, Modern Algebra had a VX-script for this, please search for it
I don't quite get what you want, but I bet it is that you want to render X image next to X text, with X image being *dynamic*? as in, not manually set in the editor?
if that is the case, I made something like it, but it is still tied to the actor's own image, from the database.

I made it so that I don't have to manually add the "show text" instruction every single time, in the editor, and edit hundreds of instructions one by one if I want to change the dialogue.
I just call "parse_dlg(args)" and it basically calls the same instruction from "show text", only modified to accept modified lines.

mind you, this is VXA, but I bet you can adapt it.
Spoiler
Code:
def parse_dlg(actorID, line)
    actor = getactor(actorID)
    #custom edit, because I use this style
    $game_message.background = 1
    $game_message.position = 1
    #
    #same code from "show text"
    $game_message.face_name = actor.face_name
    $game_message.face_index = actor.face_index
    #
    # fake initial_level, it's actually a stand-in variable I used, because I needed an extra variable
    colorID = actor.initial_level
    #
    name = actor.name
    #QuestSTR is a database I have, where many predefined lines are stored.
    #so, for "Hello, (name). Welcome to (city)" kind of lines,
    #it would bring things like "generic_greeting_00".
    #So you call for "parse_dlg(actor, generic_greeting_00)", and it brings the same line every time,
    #but you need to predefine whatever PC or NPC that would use this function, including Actors.
    qline = QuestSTR[line] || line.gsub(/\n/, " ").gsub(/\r/, "\n")
    #QuestSTR is a hash, and it watches for "line" being a symbol or not.
    #if it's not a symbol, it assumes it's a generic string, so it returns 'line' itself.
    #I use it when I need to force random lines that are not part of the quest script
    msgline = sprintf("\\>\\c[%i]%s:\\<\\c[0] \n%s", colorID, name, qline.to_s)
    $game_message.new_page
    $game_message.add(msgline)
    Fiber.yield while $game_message.busy?
  end
 
  def getactor(actorID)
    actor = RPG::Actor.new
    #another custom database I made.
    #actorID is a symbol, NPCDB returns ["actorname", "actorimage", "faceID", "color"],
    #'actorimage' is customized to be large images, or part of a standard faceset, so 'actorimages'
    #of the style of $file, are large images, and 'faceID' is always 0 in that case, otherwise it works
    #the same as "show text"
    npc = NPCDB[actorID]
    actor.initial_level = npc[3]
    actor.face_name = npc[1]
    actor.name = npc[0]
    actor.face_index = npc[2]
    return actor
  end

Spoiler
script call is something like
Code:
line = "generic text string"
[module or object].parse_dlg("ActorName", line)

returns "generic text string"
or
Code:
#in QuestSTR
:linename => "Hello.\nWelcome to place.\|"

[module or object].parse_dlg("ActorName", "linename")

returns
"Hello. (new line)
Welcome to place." (wait)
mind you, this is VXA, but I bet you can adapt it.
That is not easy because VX uses RGSS2 and VXA uses RGSS3, and have different database structures - if VXA scripts worked I would have been able to link the OP to several solutions, but he needs one for VX.
That is not easy because VX uses RGSS2 and VXA uses RGSS3, and have different database structures
he only needs actor face, actor name and color
regardless of the database structure, you can still bring actor face and actor name from whatever object Actor you work with.

the functions are super generic.... I didn't invent anything new.
if he can code, he can surely translate the instructions to VX.... everything is traceable to simpler instructions.

also *this is not a plugin*
it's just a function I wrote to help with a bigger program.
he can drop this into his program, and it should work because it's plain code.
Thank you both, this is a great help, and I really appreciate it.

Original thread: https://forums.rpgmakerweb.com/threads/using-actor-face-graphics-from-database-in-text-box-rpg-maker-vx.77192/