How to use correct face for actor in text box

Status
Not open for further replies.

JJR

Member
Veteran
Joined
Jul 22, 2013
Messages
36
Reaction score
0
First Language
English
Primarily Uses
Maybe this isn't the right spot but my question pertains to 2 things already mentioned.

Those being:

$game_party.leader

and

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?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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
 

JJR

Member
Veteran
Joined
Jul 22, 2013
Messages
36
Reaction score
0
First Language
English
Primarily Uses
Sorry for posting incorrectly. And thank you for your help. =)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top