Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Sorry, I have another question. In my game the user define the roles at the beginning of the game, while in replay they're always the default one like "landlady". Is it possible to (easy) toggle something to remember the user defined roles?

after you call the screens to get the name add this 

    $ persistent.nome_protagonista = nome_protagonista
    $ persistent.nome_landlady = nome_landlady
    $ persistent.nome_ruolo = nome_ruolo

now for the fun part 

in the replay.rpy file find this section

        for i in range(start, end + 1):
            if renpy.seen_label(Replay_items[i].replay):
                imagebutton idle Replay_items[i].thumbs:
                    style "gallery_button"
                    action Replay(Replay_items[i].replay)  # make changes to this line only!!!


and make this change

action [SetVariable("nome_protagonista", "[persistent.nome_protagonista]"), SetVariable("nome_landlady", "[persistent.nome_landlady]"), SetVariable("nome_ruolo", "[persistent.nome_ruolo]"), Replay(Replay_items[i].replay)]

I made these changes as you say;

Main script after call screen:


And in replay.rpy this change:


But doesnt work ç_ç

did you start a new game and enter some names?

Yes, even deleted persistent and started again from scratch but nothing. Maybe has something to do with that "3" above like there is an error?


Here is the code if you can put an eye on it:

default nome_protagonista = "Andrew"
default nome_landlady = "landlady"
default nome_ruolo = "tenant"
define gui.dialogue_text_outlines = [ (1.5, "#000000a8", 0, 0) ]
define gui.name_text_outlines = [ (1.5, "#000000a8", 0, 0) ]
define p = DynamicCharacter('nome_protagonista', color="#3d3dca") # Blu per il protagonista
define l = DynamicCharacter('nome_landlady', color="#ff69b4") # Rosa per la landlady
define s = DynamicCharacter('nome_ruolo', color="#00ff3c") 
define c = Character('Clarissa', color="#FFA500") define m = Character('Margot', color="#fcfc00") define j = Character('Jennifer', color="#17c2bc") screen inserisci_nome_protagonista():     zorder 100     vbox:         align (0.5, 0.5)         text "Before starting this journey, what is your name?"         input default nome_protagonista value VariableInputValue("nome_protagonista") length 20         textbutton "Confirm" action Return() screen inserisci_nome_landlady():     zorder 100     vbox:         align (0.5, 0.5)         text "Another important question, what is your landlady for you?"         input default nome_landlady value VariableInputValue("nome_landlady") length 20         textbutton "Confirm" action Return() screen inserisci_nome_ruolo():     zorder 100     vbox:         align (0.5, 0.5)         text "And you for her?"         input default nome_ruolo value VariableInputValue("nome_ruolo") length 20         textbutton "Confirm" action Return() screen check_age_screen():     zorder 100     vbox:         align (0.5, 0.5)         text "This game deals with themes not suitable for minors."         text "Have you reached the legal age in your country?"         textbutton "Yes" action Return()         textbutton "No" action Quit(confirm=False) # Inizio della storia  
                label start:     call screen check_age_screen     call screen inserisci_nome_protagonista     call screen inserisci_nome_landlady     call screen inserisci_nome_ruolo     $ persistent.nome_protagonista = nome_protagonista     $ persistent.nome_landlady = nome_landlady     $ persistent.nome_ruolo = nome_ruolo

can you post the replay_setup so I don't have to create sopmething for testing

yes, this evening I post it here, thanks

## Replay Gallery screen ######################################
##
## This is a simple screen that shows buttons that replay a scene from the game.
init python:
    maxthumbx = config.screen_width / (3 + 1)
    maxthumby = config.screen_height / (3 + 1)
    replay_page = 0
    class ReplayItem:
        def __init__(self, thumbs, replay, name):
            self.thumbs = thumbs
            self.replay = replay
            self.name = name
        def num_replay(self):
            return len(self.thumbs)
    #add replay items here format below
    #Replay_items.append(ReplayItem(["the thumbnail"], "the_label_from_code", "brief description"))
    Replay_items = []
    Replay_items.append(ReplayItem(["images/gallery/firstfall.jpg"], "firstfall", "{color=#000}Monica fall 1{/color}"))
    Replay_items.append(ReplayItem(["images/gallery/patreon.jpg"], "patreon", "{color=#000}Patreon explaination{/color}"))
# a black background screen for the selection
image black = "#000"
#the locked image for the replay gallery if you're using the gallery you can use the same (if you want to)
image replay_locked = "images/gallery/replay_lock.png"
#384x216 (16x9) set 1280x720p for the lock and thumbnails
#600x338 (16x9) set 1920x1080 for the lock and thumbnails
#replay thumbnails images setup defined here

are you using the Replayexit screen ?

a quick fix is at each replay label add this before the Replayexit screen

label firstfall:
    if _in_replay:      
        $ nome_protagonista = persistent.nome_protagonista
        $ nome_landlady = persistent.nome_landlady
        $ nome_ruolo = persistent.nome_ruolo

you mean this? $ renpy.end_replay() 

If you talk about the exit button nope, I don't have it in my replays

But you think that my code for choose names and roles is right? I have to admit, is from chat gpt 4 lol. Sorry if I bother you.

it works, so...

(1 edit)

those lines are because you haven't used default of define for those variables, but you don't have to do that with persistent variables