How to use correct face for actor in text box

● ARCHIVED · READ-ONLY
Started by JJR 4 posts View original ↗
  1. Maybe this isn't the right spot but my question pertains to 2 things already mentioned.

    Those being:

    $game_party.leader

    and

    Spoiler
    Showing a text box with pure script
    $game_message.position = X
    0 -Top
    1- Middle
    2- Bottom
    $game_message.background = X
    0 - Normal
    1 - Faded
    2 - Transparent
    $game_message.face_name = 'Actor1' <- Name of the graphic plate
    $game_message.face_index = 0 <- Position in the plate of the face you are using.
    $game_message.face_name = 'Actor1'
    $game_message.face_index = 0
    $game_message.background = 2
    $game_message.position = 0
    $game_message.add("Text")
    I have a script that lets the player choose which character they want to play as. But now when I am in the game and want to have that player saying text how would I go about putting their correct faceplate in? I currently have 31 available choices, and it seems absurd to check every single one.

    Is there an easy call with the $game_party.leader, like maybe adding .face_name or something to it so I can just populate whatever actor id they are using into a text window when I make speech for them?
  2. No, not really the right spot - you're asking how to handle a game mechanic that's complicated by the way you've set your game up, which is not really a "script call equivalent of an event", so I've split it out.

    I will start by saying, if you have 31 actors in your database and only ONE of them will be in the game, and that one depends on the player's choices, then that's a really, really bad way to do it. As you've found out, there's the issue of the face graphic. But there will be many more issues down the track - every time you want to change something about the actor, you'll have to do a 31-way conditional branch to see which actor it is, and then the appropriate command for each one. Or resort to doing everything with script calls.

    The better approach would have been to use ONE actor, and based on the player's choices, used the Change Actor Graphic and Change Actor Class commands to customize that single actor.

    However, your show text issue would still remain. This issue has come up several times over the last week or so, and I've made this little script that will solve the problem. Just paste it into its own Materials slot below all others, and in your Show Text, don't select a face graphic at all (when you're doing dialogue for the actors - you'll still need to do it for NPCs), and put \f[n] where n is the actor id. You can also use \f[\v[n]] where n is the variable that contains the actor id.

    Code:
    class Window_Base < Window  alias shaz_ffa_convert_escape_characters convert_escape_characters  def convert_escape_characters(text)    result = shaz_ffa_convert_escape_characters(text)    result.gsub!(/\eF\[(\d+)\]/i) {      $game_message.face_name = $game_actors[$1.to_i].face_name      $game_message.face_index = $game_actors[$1.to_i].face_index      ''    }    result  endend
  3. Sorry for posting incorrectly. And thank you for your help. =)
  4. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.