Easy way to give characters different nameboxes

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Aviala
Miko-Class Veteran
Posts: 533
Joined: Tue Sep 03, 2013 8:40 am
Completed: Your Royal Gayness, Love Bug, Lovingly Evil
Organization: Lizard Hazard Games
Tumblr: lizardhazardgames
itch: aviala
Location: Finland
Contact:

Easy way to give characters different nameboxes

#1 Post by Aviala »

Hey all,

I was struggling because my artist wanted me to give each character a different namebox and I couldn't find a tutorial that worked for me (most of them were using the old UI/ styles code). After a bit of googling and creative thinking, I present to you:

A foolproof way to give characters different nameboxes!

In screens.rpy, change this line in the style namebox code:

Code: Select all

    #background Frame("gui/namebox.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign)
To a ConditionSwitch!

Code: Select all

    background ConditionSwitch(
        "_last_say_who == 'a'", Frame("gui/namebox_artist.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign),
        "_last_say_who == 'n'", Frame("gui/namebox_inneryou.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign),
        "_last_say_who == 'an'", Frame("gui/namebox_animator.png", gui.namebox_borders, tile=gui.namebox_tile, xalign=gui.name_xalign),
        )
The letter after _last_say_who is your character name tag that you use when you display dialogue.
After Frame( you write the name of the namebox image you want to use.

Note that all of the namebox images used should be the same size and positioned identically or there will be problems with the image alignment. You can adjust it by playing around with this code but the easiest way is to have the images match.

This has worked for me so far, but please let me know if you run into any problems using this method - it hasn't been thoroughly tested yet.

Post Reply

Who is online

Users browsing this forum: No registered users