21 April 2025

How to show different dialogue boxes for different characters

 Want to show different dialogue boxes depending on the character? You can create as many dialogue boxes (also called 'say screens') as you like, which can then be assigned to your characters when you define then. Then whenever that character is speaking, it will use the version of the dialogue box you set against it.

Here's a simple example demonstrating how to align a character's name to the right side of the say screen:

Here is an example for where I shift the character's name to the right side of their dialogue:

screen right_aligned_say(who, what):
        window:
                identifier "dialogue_window"
                if who is not None:
                window:
                        horizontal_alignment 1.0
                        identifier "character_name_box"
                        style "name_format"
                        text who identifier "speaker_name"
                text what identifier "spoken_text"

        define right_speaker = Character("Right", screen="right_aligned_say")

        label game_start:
        right_speaker "This is an example of the text appearing on the right."
        normal_speaker "This text should appear normally."
        return

In this code, we've taken the standard say screen as a base, renamed it shifted_name_say, and then used x_alignment 1.0 to position the character's name on the right edge of the dialogue box. We then define a character, right_nami, and instruct Ren'Py to use our shifted_name_say screen whenever this character speaks.

No comments:

Post a Comment

How to show different dialogue boxes for different characters

 Want to show different dialogue boxes depending on the character? You can create as many dialogue boxes (also called 'say screens')...