Text Commands - Draw Actor Face by Actor ID

Discussion in 'RPG Maker VX Ace' started by optimum45, Apr 26, 2015.

    Tags:
  1. optimum45

    optimum45 Veteran Veteran

    Messages:
    537
    Likes Received:
    64
    Location:
    Florida
    First Language:
    English
    This seems like something that should be easy, or maybe I'm just not seeing it.  I've looked all over for what I expected to be an easy fix, and found a lot of very confusing stuff on the topic.  So, off to post it I go.

    My "Hero" has a number of different possible faces and spritesets, based on the choices they make and the classes they choose.  But, to avoid the silent hero syndrome, which is the easy way to avoid this issue, I was hunting for a way for the game to just pull the actor's face by it's ID number.  Or another way that would allow the players choice to show without having to code a thousand lines of script.

    Certainly it can't be terribly difficult, can it?

    I await the noobie smackdown.

    Thanks for your time.   :)
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    35,266
    Likes Received:
    9,814
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    You're right - it should exist, but it doesn't.

    Put this into a new script slot below Materials. In your Show Text, don't choose a face at all, and put \f[n] at the start of your text, where n is the actor id. It will show whatever face is assigned to that actor at the time the message is shown.

    Code:
    # Show Actor Face (by Shaz)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
     
    Last edited by a moderator: Apr 26, 2015
    #2
    Raghin, optimum45 and Kvich like this.
  3. optimum45

    optimum45 Veteran Veteran

    Messages:
    537
    Likes Received:
    64
    Location:
    Florida
    First Language:
    English
    Works like a charm.  I figured it had to be somewhat easy.  

    Changes have been installed and appropriate credits are in place.

    Your Skills Are Awesome   :o

    Many thanks!
     
    Last edited by a moderator: Apr 26, 2015
    #3
  4. Krath

    Krath Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    I don't suppose anyone is willing to update this for MV?  I'm having the exact same issue as Optimum did.

    Thanks!
     
    #4
  5. Krath

    Krath Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    English
    Whelp my first post hasn't gone through yet since I'm new and it hasn't been approved yet but thought I'd throw this on here anyway.  I kept hunting and found where HimeWorks has already made a plugin doing just that.  Link below.  Thanks all and happy coding!

    http://himeworks.com/2015/11/placeholder-message-faces/
     
    #5
  6. Shaz

    Shaz Veteran Veteran

    Messages:
    35,266
    Likes Received:
    9,814
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Please forgive the necropost.

    Reposting the code as the forum change removed all the line breaks, and I don't think I have a thread for this snippet.

    Code:
    # Show Actor Face (by Shaz)
    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
      end
    end

    actually, I realised after hitting Submit that I could have just edited the original post. Sorry.


    And for @Krath, MV comes with this as the More Escape Codes plugin.
     
    #6
    Raghin likes this.
  7. Raghin

    Raghin Nooblish Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    I really don't understand what I am doing wrong with this and it makes me feel like an imbecile considering I should know how to do this as a programmer (though i never studied ruby).......... I have literally copy pasted the code (even prior to the repost I evidently had it in correct format), and all tutorials seem to say thats literally all you do aside from reading documentation for instructions. Thankyou Shaz for taking the time to repost the code in proper format, but it seems that wasn't the problem..... Would really like to figure this out so I can easily manage my game (player can select their character, so this is invaluable).

    It's in the correct location. In the correct format. Copy pasted. Attempted with \f[n] like instructed......

    If anyone at all has any possible insight as to what might be the problem I would greatly appreciate the assistance. (It's in the )
     
    #7
  8. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    925
    Likes Received:
    157
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Well, first off even though you're having the same issue you need to make you own thread. You can put a link in your thread to this thread for reference.
    second you did not explain what exactly is going wrong for you. You said you put the code in and followed instructions, but that sometimes doesn't as people make silly mistakes.
    After you make a new thread we may ask you for screen shots to see what you did.
     
    #8

Share This Page