Creating different dialog boxes for different characters?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
ketskari
Veteran
Posts: 296
Joined: Tue Dec 21, 2010 6:22 pm
Completed: Asher, Sunrise, Tell a Demon
Projects: Asher Remake, TEoA
Organization: Sun Labyrinth
Tumblr: sunlabyrinth
Deviantart: sunlabyrinth
itch: sunlabyrinth
Contact:

Creating different dialog boxes for different characters?

#1 Post by ketskari »

First--sorry, I'm really new at this.

Anyway, is it possible to create multiple dialog frame images for different characters? I wanted the narrator, for instance, to have a sort of old paper-themed background, while I'd want the characters to speak with a different background image?

Thanks!

Naeddyr
Newbie
Posts: 13
Joined: Mon Oct 12, 2009 4:06 am
Contact:

Re: Creating different dialog boxes for different characters

#2 Post by Naeddyr »

This is possible. The easiest way *I* can think of (I'm a novice so wait around until someone else gives better advice) is simply to replace the current "say" screen with a new one.

http://www.renpy.org/doc/html/screens.h ... n-language

The "say" statement (which is also the default statement that doesn't need the keyword, so you have

Code: Select all

character "text"
instead of

Code: Select all

say character "text"
) sends its parameters and stuff into a "say" screen, and if you make your own "say" screen, replacing the old one, you can have a conditional within that checks what character is speaking, and adjusts the looks of the screen appropriately, using if-statements.

Code: Select all

screen say:
    window id "window":
        vbox:
            spacing 10
            text who id "who"
            text what id "what"
This creates a normal-looking ADV textbox, with a line for the character name and the rest of the box being text. If you wanted to change the background if the character speaking is, say, named Randalf the Ray, you could do something like this:

Code: Select all

screen say:
    window id "window":
        if who == "Randalf the Ray" : # The who variable contains a string that represents the character name. This is sent by the say statement to the window. The what variable contains a string of what is said. Very cute.
            background = magicalsuperpowers # This probably looks arse, but something like this.
        vbox:
            spacing 10

            if who: # This bit is here to just make sure that an empty line isn't drawn if the character name is empty.
                text who id "who"
            text what id "what"
This is just one simplistic way to do this.

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Creating different dialog boxes for different characters

#3 Post by backansi »

Code: Select all

init:
    $ e = Character('eileen', window_background = Frame( 'eileen_frame.png', 10, 10) )
    $ narrator = Character('', window_background = Frame('narrator_frame.png', 10, 10 ) )
label start:
    e "Hi. I'm using my own window frame now."
    'If this string is shown, you will see the text window which is using different frame.'
    e 'Well, there is a lot of way to make what you want when you're scripting or programming or.. whatever.'
    e 'Anyway this is the way that I suggest to you.'

User avatar
ketskari
Veteran
Posts: 296
Joined: Tue Dec 21, 2010 6:22 pm
Completed: Asher, Sunrise, Tell a Demon
Projects: Asher Remake, TEoA
Organization: Sun Labyrinth
Tumblr: sunlabyrinth
Deviantart: sunlabyrinth
itch: sunlabyrinth
Contact:

Re: Creating different dialog boxes for different characters

#4 Post by ketskari »

Thanks!!! :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], DewyNebula