Ren'Py Talk to everyone to end freeroam

DanStory

Newbie
Sep 30, 2021
50
66
I want to make screen, but the MC must talk to everyone first then he can end freeroam
if he doesn't talk to all characters then he can't end freeroam
can someone here help me?
This is my screen for classroom and then jump into label
Python:
screen classroomday10_1:
    imagemap:
        ground "classroom_day10_idle.png"
        hover "classroom_day10_hover.png"

        hotspot (1519,52,215,329) action Jump("talk_colton_day10_1")
        hotspot (1134,416,338,386) action Jump("chair_endroam_day10_1")
        hotspot (114,159,259,362) action Jump("talk_jalen_day10_1")
        hotspot (638,206,170,197) action Jump("talk_olivia_day10_1")
        hotspot (825,184,154,197) action Jump("talk_andrea_day10_1")
 

Cincinnatus222

Newbie
Game Developer
Feb 3, 2022
25
52
I'm just started using renpy myself, so hopefully someone with more experience can provide a better solution, but I'll make a suggestion that might work.

I'm guessing that after MC talks to each person, it goes back the screen. Perhaps you could define a variable for each conversation like "jalen_done" and then have a condition statement on the screen to jump to next scene if the conversations are done or else allow the player to select the next hotspot.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,229
I want to make screen, but the MC must talk to everyone first then he can end freeroam
if he doesn't talk to all characters then he can't end freeroam
can someone here help me?
You need a flag-like system for this.

Each time the MC talk to a character, you raise(-like) the corresponding flag, and you display as active only the characters he haven't talked to yet.
Then you complete this with a final test telling that the MC have talked to everyone.

With your actual screen, one of the many way to do it could be something like this:
Python:
# The flag-like system.
default freeroamingFlags = []

screen classroomday10_1:

    imagemap:
        ground "classroom_day10_idle.png"
        hover "classroom_day10_hover.png"

        # Display only if the MC haven't talked to this character yet.
        if not "colton" in freeroamingFlags:
            hotspot (1519,52,215,329) action Jump("talk_colton_day10_1")
        if not "jalen" in freeroamingFlags:
           hotspot (114,159,259,362) action Jump("talk_jalen_day10_1")
        if not "olivia" in freeroamingFlags:
           hotspot (638,206,170,197) action Jump("talk_olivia_day10_1")
        if not "andrea" in freeroamingFlags:
           hotspot (825,184,154,197) action Jump("talk_andrea_day10_1")
# Display only if the MC have talked to all characters.
if len( freeroamingFlags ) == 4:
# Reset the flag-like list before going out, to prepare for the
# next freeroaming part.
hotspot (1134,416,338,386) action [ SetVariable( "freeroamingFlags", [] ), Jump("chair_endroam_day10_1") ]

label talk_colton_day10_1:
$ freeroamingFlags.append( "colton" )
[...]

label talk_jalen_day10_1:
$ freeroamingFlags.append( "jalen" )
[...]

label talk_olivia_day10_1:
$ freeroamingFlags.append( "olivia" )
[...]

label talk_andrea_day10_1:
$ freeroamingFlags.append( "andrea" )
[...]
[/QUOTE]

I'm usually not a fan of flags being expressed as list, but here it's effectively the easiest approach. The "is it lower" test stay basic, while it's also easy to know if all flags have been raised, and to reset them all at once.
 

DanStory

Newbie
Sep 30, 2021
50
66
You need a flag-like system for this.

Each time the MC talk to a character, you raise(-like) the corresponding flag, and you display as active only the characters he haven't talked to yet.
Then you complete this with a final test telling that the MC have talked to everyone.

With your actual screen, one of the many way to do it could be something like this:
Python:
# The flag-like system.
default freeroamingFlags = []

screen classroomday10_1:

    imagemap:
        ground "classroom_day10_idle.png"
        hover "classroom_day10_hover.png"

        # Display only if the MC haven't talked to this character yet.
        if not "colton" in freeroamingFlags:
            hotspot (1519,52,215,329) action Jump("talk_colton_day10_1")
        if not "jalen" in freeroamingFlags:
           hotspot (114,159,259,362) action Jump("talk_jalen_day10_1")
        if not "olivia" in freeroamingFlags:
           hotspot (638,206,170,197) action Jump("talk_olivia_day10_1")
        if not "andrea" in freeroamingFlags:
           hotspot (825,184,154,197) action Jump("talk_andrea_day10_1")
# Display only if the MC have talked to all characters.
if len( freeroamingFlags ) == 4:
# Reset the flag-like list before going out, to prepare for the
# next freeroaming part.
hotspot (1134,416,338,386) action [ SetVariable( "freeroamingFlags", [] ), Jump("chair_endroam_day10_1") ]

label talk_colton_day10_1:
$ freeroamingFlags.append( "colton" )
[...]

label talk_jalen_day10_1:
$ freeroamingFlags.append( "jalen" )
[...]

label talk_olivia_day10_1:
$ freeroamingFlags.append( "olivia" )
[...]

label talk_andrea_day10_1:
$ freeroamingFlags.append( "andrea" )
[...]
I'm usually not a fan of flags being expressed as list, but here it's effectively the easiest approach. The "is it lower" test stay basic, while it's also easy to know if all flags have been raised, and to reset them all at once.
[/QUOTE]
What method do you usually use sir?
I mean I'm a newbie so, this is the only way I know
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,229
What method do you usually use sir?
Hmm... It totally depend on the context, and strictly speaking there isn't methods that I prefer, but more methods that aren't at all adapted to the said context.

By example, here the constraints where: Easy to reset and easy to know when all are raised.
Therefore, the "flags" needed to be grouped, in a way or another. I chose a list, but a dict would also have worked:
Python:
default freeroamingFlags = {}

screen whatever():
    if "andrea" in freeroamingFlags:
        [...]
    if len( freeroamingFlags ) == 4:
        [...]
        action [ SetVariable( "freeroamingFlags", {} ), [...]

label whatever:
    $ freeroamingFlags["andrea"] = True
    [...]
But it's a less intuitive approach for the assignation.

If the game offer the possibility to talk more than once to the character, with the second scene being some kind of "but, we just talked together few minutes ago", a set could have been a better approach:
Python:
default freeroamingFlags = set( [] )

screen whatever():
    [the hotspots]

    if len( freeroamingFlags ) == 4:
        [...]
        action [ SetVariable( "freeroamingFlags", set( [] ) ), [...]

label whatever:
    if not "andrea" in freeroamingFlags:
        [the original scene]
    else:
        a "You again ?"
        mc "Oops, sorry."
    $ freeroamingFlags.add( "andrea" )
    call screen whatever
    [...]
A set is like a list, but entities can only be present once. So it's not a problem if you add "andrea" more than once, it will appear only one time.
Python:
label start:
    $ myList = [ "abc" ]
    $ mySet = set( [ "abc" ] )
    $ myList.append( "abc" )
    $ mySet.add( "abc" )
    
    $ tmp = len( myList )
    "Length of the list is [tmp]"  # Will be 2
    $ tmp = len( mySet )
    "Length of the set is [tmp]"  # Will be 1
But for a more global need, it's better to use directly a boolean variable:
[Don't take too much attention to the dialog, I stayed to long under the sun...]
Python:
default kiss = False
default phoneNumber = False

label whatever:
    mc "Hey pretty girl, have you lost something ?"
    girl "Oh yes, charming alpha male MC, it's my bag, can you help me to find it ?"
    mc "Of course I can."
    [...]
    girl "Oh, thanks you, thanks you MC, you save my life."
    mc "It's nothing beautiful girl."
    menu:
        "Ask for a kiss as reward":
            $ kiss = True
            girl "Oh MC... you're so manly, how could I resist ?"
        "Be a loser":
            pass
    girl "I need to go now, my poor mother is ill, I can't stay absent of the house too long."
    if kiss is True:
        menu:
            "Ask for her phone number":            
                $ phoneNumber = True
                girl "Hihi, here it is, MC. Call me and I promise I'll loose something else."
                mc "What ?"
                girl "My virginity, hihi."
                mc "Haha, you are not just pretty, you are also funny."
            "You're more the one night kiss person":
                pass
    else:
        mcThoughts "It's not with such player choosing for me that I'll fuck girls."
**The abuse of cheaply written stories is bad for your mental health.**

Alternatively, the dict approach also works here. Once again it's a bit more works, but everything is stored in one place:
[I'll spare you my bad dialogs]
Python:
default flags

label whatever:
    [...]
    menu:
        "Ask for a kiss as reward":
            $ flags["kiss"] = True
            [...]
        "Be a loser":
            $ flags["kiss"] = False
    [...]
    if flags["kiss"] is True:
        menu:
            "Ask for her phone number":            
                $ flags["phoneNumber"] = True
                [...]
            "You're more the one night kiss person":
                $ flags["phoneNumber"] = False
    else:
        [...]
There's other methods, but either they are not adapted for Python, or don't really add something to the ones presented here.
 

DanStory

Newbie
Sep 30, 2021
50
66
Hmm... It totally depend on the context, and strictly speaking there isn't methods that I prefer, but more methods that aren't at all adapted to the said context.

By example, here the constraints where: Easy to reset and easy to know when all are raised.
Therefore, the "flags" needed to be grouped, in a way or another. I chose a list, but a dict would also have worked:
Python:
default freeroamingFlags = {}

screen whatever():
    if "andrea" in freeroamingFlags:
        [...]
    if len( freeroamingFlags ) == 4:
        [...]
        action [ SetVariable( "freeroamingFlags", {} ), [...]

label whatever:
    $ freeroamingFlags["andrea"] = True
    [...]
But it's a less intuitive approach for the assignation.

If the game offer the possibility to talk more than once to the character, with the second scene being some kind of "but, we just talked together few minutes ago", a set could have been a better approach:
Python:
default freeroamingFlags = set( [] )

screen whatever():
    [the hotspots]

    if len( freeroamingFlags ) == 4:
        [...]
        action [ SetVariable( "freeroamingFlags", set( [] ) ), [...]

label whatever:
    if not "andrea" in freeroamingFlags:
        [the original scene]
    else:
        a "You again ?"
        mc "Oops, sorry."
    $ freeroamingFlags.add( "andrea" )
    call screen whatever
    [...]
A set is like a list, but entities can only be present once. So it's not a problem if you add "andrea" more than once, it will appear only one time.
Python:
label start:
    $ myList = [ "abc" ]
    $ mySet = set( [ "abc" ] )
    $ myList.append( "abc" )
    $ mySet.add( "abc" )
   
    $ tmp = len( myList )
    "Length of the list is [tmp]"  # Will be 2
    $ tmp = len( mySet )
    "Length of the set is [tmp]"  # Will be 1
But for a more global need, it's better to use directly a boolean variable:
[Don't take too much attention to the dialog, I stayed to long under the sun...]
Python:
default kiss = False
default phoneNumber = False

label whatever:
    mc "Hey pretty girl, have you lost something ?"
    girl "Oh yes, charming alpha male MC, it's my bag, can you help me to find it ?"
    mc "Of course I can."
    [...]
    girl "Oh, thanks you, thanks you MC, you save my life."
    mc "It's nothing beautiful girl."
    menu:
        "Ask for a kiss as reward":
            $ kiss = True
            girl "Oh MC... you're so manly, how could I resist ?"
        "Be a loser":
            pass
    girl "I need to go now, my poor mother is ill, I can't stay absent of the house too long."
    if kiss is True:
        menu:
            "Ask for her phone number":           
                $ phoneNumber = True
                girl "Hihi, here it is, MC. Call me and I promise I'll loose something else."
                mc "What ?"
                girl "My virginity, hihi."
                mc "Haha, you are not just pretty, you are also funny."
            "You're more the one night kiss person":
                pass
    else:
        mcThoughts "It's not with such player choosing for me that I'll fuck girls."
**The abuse of cheaply written stories is bad for your mental health.**

Alternatively, the dict approach also works here. Once again it's a bit more works, but everything is stored in one place:
[I'll spare you my bad dialogs]
Python:
default flags

label whatever:
    [...]
    menu:
        "Ask for a kiss as reward":
            $ flags["kiss"] = True
            [...]
        "Be a loser":
            $ flags["kiss"] = False
    [...]
    if flags["kiss"] is True:
        menu:
            "Ask for her phone number":           
                $ flags["phoneNumber"] = True
                [...]
            "You're more the one night kiss person":
                $ flags["phoneNumber"] = False
    else:
        [...]
There's other methods, but either they are not adapted for Python, or don't really add something to the ones presented here.
Thank you sir i'll try it
 

DanStory

Newbie
Sep 30, 2021
50
66
I'm just started using renpy myself, so hopefully someone with more experience can provide a better solution, but I'll make a suggestion that might work.

I'm guessing that after MC talks to each person, it goes back the screen. Perhaps you could define a variable for each conversation like "jalen_done" and then have a condition statement on the screen to jump to next scene if the conversations are done or else allow the player to select the next hotspot.
thank you for your help sir