Defining 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
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Defining characters

#1 Post by kostek00 »

I defined characters but they have quite a bit of code in them that is repeating. I'm pretty sure I saw somewhere in documentation that you can somehow define style for characters once and then just use it in defining characters but I can't find it now.

This is code for some of characters. As you can see first four have repeating styles.

Code: Select all

define girl_b = Character('Girl A', color="#2a82a7", who_size=27, who_xpos=27, who_font="fonts/Franklin Gothic Medium.ttf", who_outlines=[(2, (0,0,0, 120), 2,2), (1, (255,225,255, 255)), (2, (255,255,255, 150))], what_size=22, what_font="fonts/Franklin Gothic Medium.ttf", what_drop_shadow=[(2, 2)])
define girl_c = Character('Girl B', color="#2a82a7", who_size=27, who_xpos=27, who_font="fonts/Franklin Gothic Medium.ttf", who_outlines=[(2, (0,0,0, 120), 2,2), (1, (255,225,255, 255)), (2, (255,255,255, 150))], what_size=22, what_font="fonts/Franklin Gothic Medium.ttf", what_drop_shadow=[(2, 2)])
define child_a = Character('Child A', color="#2a82a7", who_size=27, who_xpos=27, who_font="fonts/Franklin Gothic Medium.ttf", who_outlines=[(2, (0,0,0, 120), 2,2), (1, (255,225,255, 255)), (2, (255,255,255, 150))], what_size=22, what_font="fonts/Franklin Gothic Medium.ttf", what_drop_shadow=[(2, 2)])
define child_b = Character('Child B', color="#2a82a7", who_size=27, who_xpos=27, who_font="fonts/Franklin Gothic Medium.ttf", who_outlines=[(2, (0,0,0, 120), 2,2), (1, (255,225,255, 255)), (2, (255,255,255, 150))], what_size=22, what_font="fonts/Franklin Gothic Medium.ttf", what_drop_shadow=[(2, 2)])
define narrator = Character(what_size=22, what_font="fonts/Franklin Gothic Medium.ttf", what_drop_shadow=[(2, 2)])
I'm also wondering how can I force Ren'py to use font I want in everything in game (one for everything). I tried to use definition from new gui but it's not working with my code. It's using default to Ren'py font that's why I added font in defining characters above.

Code: Select all

screen say(who, what):
    window:
        id "window"

        vbox:
            if who is not None:
                style "name"
                text who id "who"

            style "dialog"
            text what id "what"

    use quick_menu

# Textbox style
style window:
    xalign 0.5
    yalign 1.0
    xsize 800
    ysize 180
    right_padding 168
    background "images/gui/window.png"

style name:
    xpos 38
    ypos 10
    spacing 6

style dialog:
    xpos 38
    ypos 53
Does characters can be styled like example above for window and then call it in character defining like style="main_character"?

Code: Select all

style main_character:
	some style here

style secondary_character:
	some style here
Last edited by kostek00 on Tue May 22, 2018 3:33 pm, edited 1 time in total.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Defining characters

#2 Post by gas »

You can streamlinw the chara definition by creating a generic chara and use it as kind in others.
Find it at the end of dialogues section in the docs.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Defining characters

#3 Post by Remix »

You will want to tweak gui.rpy...

e.g.

## The font used for character names.
define gui.name_text_font = "fonts/Franklin Gothic Medium.ttf"

Most of the bits to alter are near there, around line 150+ on mine
Frameworks & Scriptlets:

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Defining characters

#4 Post by kostek00 »

gas wrote: Tue May 22, 2018 3:29 pm You can streamlinw the chara definition by creating a generic chara and use it as kind in others.
Find it at the end of dialogues section in the docs.
Found it, thanks.
Remix wrote: Tue May 22, 2018 4:32 pm You will want to tweak gui.rpy...

e.g.

## The font used for character names.
define gui.name_text_font = "fonts/Franklin Gothic Medium.ttf"

Most of the bits to alter are near there, around line 150+ on mine
Already tried that but to be sure I checked again but still without success. Maybe it's because I'm using imagemaps for most of stuff? Dunno.

Code: Select all

define gui.text_font = "fonts/Franklin Gothic Medium.ttf"
define gui.name_text_font = "fonts/Franklin Gothic Medium.ttf"
define gui.interface_text_font = "fonts/Franklin Gothic Medium.ttf"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Vamp-sama