Ren'Py Changing the narrative text style

RichyCapy

Active Member
Game Developer
Jul 26, 2017
763
844
Hi

So, I already started making my game... we removed the dialog box, and change the character define to something like this

Code:
define andy_character = Character("Andy", color="#ba0d15", what_font="fonts/Cabold-Comic.ttf", what_size=28, who_outlines=[ (3, "#161616") ], what_outlines=[ (4, "#161616") ])
So now, when we use a character
Code:
andy_character "Although...I haven't seen her since I was little. How will she know what I look like?"
His dialog look like this:
1.png

Which it looks better rather than to use a dialog box, but now my problem is when the dialog is not said by no one

Using this:
Code:
"{i}However, ever since I can remember, my parents had lots of problems.{/i}"
It looks like this:
2.png

So my question is:
Is there a way to create a style on something so I can add it to the code WITHOUT changing the gui.text_font or the gui.interface_text_font since that would mess up my menus and customized screens?

Thanks a lot in advance
 

moskyx

Forum Fanatic
Jun 17, 2019
4,005
12,959
Before someone more skilled gives you the right answer, you can try creating a "narrator" character
Code:
define narrator = Character(None, #insert here any font and colour desired)
 
  • Like
Reactions: anne O'nymous

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
Okay... The main thing here is that you have applied the font ONLY to that character, rather than all dialogue text.

So when you use a different character (or in this case, no character at all), you get the default font.

The easiest solution I can see is to change the screen which displays the dialogue text.
Dialogue is usually shown using the "say" screen. Within that are various elements, the most obvious of which are the speaking character's name (say_label) and what the character is saying (say_dialogue).

Therefore, just tag style "{yourfontnamehere}.ttf" into the dialogue definition to override the font used for all spoken dialogue.

Python:
# ---- screens.rpy ----

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos
    font "my_favorite_font.ttf" # -- added to change the default font used.
 

RichyCapy

Active Member
Game Developer
Jul 26, 2017
763
844
Hi! I just found out the answer, just define it like other character:

Code:
define narrator = Character (None, what_font="fonts/Cabold-Comic.ttf", what_size=28, who_outlines=[ (3, "#161616") ], what_outlines=[ (4, "#161616") ])
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,581
2,219
So if you end up having 8 characters in your game, you're going to override the font in 9 separate places (8 characters + 1 narrator)?

The example I gave would override the font for ALL dialogue ANY of the characters say, without affecting any other font in the game (menus, options screens, etc). Just set it in that one place and forget all about it.

It just feels like you're picking the hard way.

btw, the same applies to some of those other settings like text size and outlines.

If ALL your what_size are going to be 28, ALL your what_outlines are going to be "(4,#161616)" and ALL your what_outlines are going to be "(3,#161616)"...

... you could simply change the screens.rpy files to this:

Python:
style say_label:
    properties gui.text_properties("name", accent=True)
    xalign gui.name_xalign
    yalign 0.5
    outlines [(3,"#161616")]

style say_dialogue:
    properties gui.text_properties("dialogue")

    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos
    font "fonts/Cabold-Comic.ttf"
    outlines [(4,"#161616")]
    size 28
then not have override those values everytime using the character definition.

Works just the same, with a lot less faffing about.
 

Basilicata

Radioactive Member
Game Developer
Oct 24, 2017
1,345
3,117
One other thing to keep in mind is: Changed GUI, fonts, buttons etc might not look as good in android, especially phones. You better check it out first.