Changing the UI based on player choices?

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
tofire
Newbie
Posts: 7
Joined: Fri Mar 12, 2021 6:55 pm
Contact:

Changing the UI based on player choices?

#1 Post by tofire »

Hi, i got a question regarding the UI.

I know u can change it completely and what not, but i wanna know if you can change it depending on what the player does.
For example, in my game, there are different locations that have their own theme. In the first chapter, there is only one location you can start in, which is colorful, and the UI reflects that, but in the second chapter there s 4 in total. Each are unique, and the bright colorful UI wouldn't fit them.

The player is sent to the locations depending on who is still present. So for example if there are A,B,C and D characters, and character D leaves (which the player has control over), you get sent to location X specifically, where the entirety chapter 2 will take place.

Under these conditions, can you change it? like have some sort of code that basically does "if player triggers location X, change UI to location x UI" and overriding any existing UI.

I haven't actually made the first UI yet, but all i plan on changing is the colors. So basically just a new coat of paint depending on which location you're in.

Hope i explained myself properly. Feel free to ask any additional questions if i didn't. take a shot every time i say UI

laure44
Regular
Posts: 84
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

Re: Changing the UI based on player choices?

#2 Post by laure44 »

Hey there,

I haven't tested it myself, but I'm guessing you can use a variable that you will update whenever you change location. Then you could use conditions to change the UI inside of your screens. Something like:

Code: Select all

default ui_design = "default"

screen ui_screen(): # just a random name, do this in existing screens that handle the ui you want to change
    if ui_design == "default":
        # default ui here...
    elif ui_design == "variant1":
        # different ui here...
    # etc
You could apply this to textboxes, frames or backgrounds in game menus.

tofire
Newbie
Posts: 7
Joined: Fri Mar 12, 2021 6:55 pm
Contact:

Re: Changing the UI based on player choices?

#3 Post by tofire »

Thank you laure ^^ i'll try it out when the time comes.

Post Reply

Who is online

Users browsing this forum: No registered users