Multiple endings?

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
dramaticaluniweeb
Newbie
Posts: 15
Joined: Sun Jun 12, 2016 1:28 am
Contact:

Multiple endings?

#1 Post by dramaticaluniweeb »

Okay, sooo...I am a TOTAL noob. Just putting it out there. I'm working on a little VN for my friend, but I want there to be multiple paths based on previous choices, just as the tutorial mentioned, but when I tried poking around with 'if' and 'and' statements, nothing worked. So I used elif statements. That just ran through a random line of text and then went to one ending. I really don't understand what's going on.

Here's the section of code that always messes up:

Code: Select all

 menu:
        "Romantic":
            jump atmosphere1_true
            
        "Summer hangout":
            jump atmosphere1_false
            
    label atmosphere1_true:
    
        $ love_flag = True
        
        c "I have to agree with Aoba.  This does seem like a pretty good spot for a romantic picnic."
        
        "I can almost feel Aoba grinning.  She suddenly leans over and starts whispering in my ear."
        
        a "Pretty sure I saw Mink look at you."
        
        c "She didn't."
        
        a "Mmmm, I'm pretty sure she did."
        
        jump atmosphere1_done
        
    label atmosphere1_false:
    
        $ love_flag = False
        
        c "I think it's a friendlier environment."
        
        k "Right?? I'd bring you guys, not my girlfriend."
        
        a "Whatever, then.  I'll stay in my fantasy world."
        
        "I glance over at Mink."
        
        "She's still sipping her soda without a word."
        
        "Wait...I've never heard of a soda company called 'Bud Light'."
        
        "I'll just...ignore that, I guess."
        
        jump atmosphere1_done
        
    label atmosphere1_done:
        
        "Koujaku and Aoba set down their sodas and suddenly stand up in perfect unison."
        
        "...as if they planned it."
        
        "Wait a second."
        
        k "Me and Aoba are gonna go for a swim.  Either of you coming along?"
        
        "I stare up at the two of them for a short while.  Nothing happens until..."
        
    menu:
        "Mink stands up":
            jump swim1_true
            
        "Mink grabs another 'soda'":
            jump swim1_false
            
    label swim1_true:
        
        $ they_swim = True
        
        "Mink suddenly puts down her drink and stands up."
        
        m "Might as well."
        
        "She shrugs her coat off as Aoba and Koujaku leap into the water."
        
        "Did she really walk down to the river in nothing but a coat and a bikini?!"
        
        "Instead of jumping in, she carefully steps down from the port and walks in.  She's tall enough that where Aoba and Koujaku have water up to their chests, the water only touches her waist."
        
        "Aoba and Koujaku wave wildly, gesturing towards me.  Reluctantly, I take off my shirt and fold it neatly beside Mink's crumpled-up coat before wading in like she did."
        
        "We all splash around in the water for a while."
        
        "To be accurate, Aoba and Koujaku attack each other (and me) with endless barrages of splashes, while Mink acts as our lifeguard."
        
        "She's the first one to step out of the river.  After completely soaking my one-piece, I'm next."
        
        "Aoba gets a call from her grandma pretty soon, and she suddenly starts rushing home."
        
        "Koujaku just gets bored and leaves with a simple goodbye."
        
        "Looks like it's just us..."
        
        jump swim1_done
        
    label swim1_false:
        
        $ they_swim = False
        
        "Mink twists her body around and grabs another drink from the little blue cooler we brought along."
        
        "She takes a big gulp and looks up at Koujaku and Aoba until they leave."
        
        "Aoba gets a call from her grandma pretty soon, and she suddenly starts rushing home."
        
        "Koujaku just gets bored and leaves with a simple goodbye."

        "Looks like it's just us..."
        
        jump swim1_done
        
    label swim1_done:
        
    if love_flag:
        
        c "...well, this was fun! Guess it's time to go home!"
        
        m "Hold on a second."
        
        "Mink grabs my forearm in an iron grip before I can get away."
        
        m "Sit down."
        
        "I swallow hard and slowly take a seat beside Mink.  She finally lets go and rests her elbow against her knee."
        
        c "Um..."
        
        m "Calm down.  I'm not going to kill you."
        
        m "I just wanted to ask you a question."
        
        c "Oh.  Okay.  Go ahead."
        
        "Mink doesn't say anything for a while.  She just swirls her drink absentmindedly."
        
        m "...did you ever learn to swim?"
        
        "I blink a few times."
        
        c "Uh...not officially.  I just found a pool and taught myself."
        
        m "That explains it."
        
        c "Explains what??"
        
        m "I thought you were drowning half the time you were in the water."
        
        "Am I really that bad at swimming...?"
        
        c "Well, I wasn't.  It's just how I taught myself."
        
        m "Then you need a better teacher."
        
        c "Hey, I--"
        
        "She suddenly drops something small and rectangular in my hand."
        
        "A business card?"
        
        "No, not quite.  Just a handwritten phone number in red pen."
        
        c "What's this?"
        
        "Mink simply puts her coat back on and stands up."
        
        m "If you're ever in the mood for that picnic, give me a call.  I'll see what I can do about your swimming."
        
        "She heads off, and I watch her until she disappears into the woods."
        
        "The rumbling of a motorcycle reaches my ears, and I don't move an inch until it fades completely."
        
        "...did I just get her number?"
        
        jump goodending_1
        
    elif love_flag:
        
        c "...did you know that some pirahnas aren't fully carnivores?"
        
        "Mink cocks a brow and looks over at me."
        
        m "Really."
        
        c "Some are omnivorous.  And some completely survive on plants."
        
        m "Fighting the system, I see."
        
        c "They just like to rebel, I guess."
        
        "I giggle, and for the first time ever, I see her smile.  It's an awkward little half-smile, but it'll do."
        
        m "...open your hand."
        
        "Oh, no.  Was the smile a bad thing? I slowly and reluctantly offer my hand out."
        
        "She suddenly drops something small and rectangular in my hand."
        
        "A business card?"
        
        "No, not quite.  Just a handwritten phone number in red pen."
        
        c "What's this?"
        
        "Mink simply puts her coat back on and stands up."
        
        m "I know some people who like to swim.  That number belongs to our flat.  Give us a call if your friends ditch you."
        
        c "...I will.  Thanks.  It was nice talking to you."
        
        "I hope I can see her again soon."
        
        jump goodending_2
            
    if they_swim:
        
        "Mink got up and simply patted me on the shoulder before heading off to her motorcycle."
        
        "And I was there alone, watching as the afternoon clouds drifted by."
        
        jump neutralending_1
        
    elif they_swim:
        
        c "You know, I meant what I said earlier.  About this having a romantic atmosphere."
        
        "Mink glances at me briefly."
        
        m "Really, now."
        
        c "I mean...oh, I don't know."
        
        "I sigh, and my shoulders droop."
        
        c "My last boyfriend cheated on me and broke up with me, so Aoba's been trying to get me another boyfriend, but I just...don't feel right with boys."
        
        m "Hm."
        
        c "But I don't know if I'm the problem or if all the boys I date just stink."
        
        "Mink's quiet for a while, as if she's actually thinking about it."
        
        "She suddenly pulls out a slip of paper and hands it to me."
        
        c "What's this?"
        
        m "A friend of mine's number.  He seems nice enough, and he's been looking for a girlfriend."
        
        m "You two will get along fine."
        
        "Mink gets up and simply pats me on the shoulder before heading off to her motorcycle."
        
        "And I'm left there alone, watching as the afternoon clouds drift by."
        
        jump badending_1
        
    label goodending_1:
    
        "ROMANTIC ENDING: Clear and her new girlfriend wear fabulous rainbow capes in the pride parade."
        
        return
        
    label goodending_2:
    
        "FRIENDSHIP ENDING: Clear and Mink become good friends.  Clear bonds well with Mink's flatmates."
        
        return
        
    label neutralending_1:
    
        "BORDERLINE ENDING: Clear fails to establish a deeper connection with Mink.  They're okay friends."
        
        return
        
    label badending_1:
    
        "BAD ENDING: Clear ends up with someone else while Mink watches from the sidelines.  Telling herself that she's okay with it becomes a useless strategy at some point."
        
        return
All that shows, no matter what choices I make, is either the goodending_1 dialogue and the Romantic Ending or the neutralending_1 dialogue and the Romantic ending. What I want to do is combine the two choices to have a certain ending; for example, choosing 'Romantic' and then saying that Mink stands up leads to the Romantic Ending dialogue and endscreen. And choosing others can lead to other outcomes (shown above). What I have now is just a placeholder setup so that the game can launch and run without errors; I just need to know what I can do to combine these four variables to get different outcomes. Can anyone help me here, or am I just being an idiot?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Multiple endings?

#2 Post by IrinaLazareva »

if I have correctly understood...

Code: Select all

    menu:
        "Romantic":
            jump atmosphere1_true
        "Summer hangout":
            jump atmosphere1_false
            
    label atmosphere1_true:
    
        $ love_flag = True
        "I have to agree with Aoba.  This does seem like a pretty good spot for a romantic picnic."
        "..."
        "Mmmm, I'm pretty sure she did."
        jump atmosphere1_done
        
    label atmosphere1_false:
 
        $ love_flag = False
        
        "I think it's a friendlier environment."
        "..."        
        "I'll just...ignore that, I guess."
        
        jump atmosphere1_done
        
    label atmosphere1_done:
        
        "Koujaku and Aoba set down their sodas and suddenly stand up in perfect unison."
        "..."       
        "I stare up at the two of them for a short while.  Nothing happens until..."
        
    menu:
        "Mink stands up":
            jump swim1_true
            
        "Mink grabs another 'soda'":
            jump swim1_false
            
    label swim1_true:
        
        $ they_swim = True
        
        "Mink suddenly puts down her drink and stands up."
        "..."        
        "Looks like it's just us..."
        
        jump swim1_done
        
    label swim1_false:
        
        $ they_swim = False
        
        "Mink twists her body around and grabs another drink from the little blue cooler we brought along."
        "..."        
        "Looks like it's just us..."
        
        jump swim1_done
        
    label swim1_done:
        
        if love_flag==True:
            if they_swim==True:
                "...well, this was fun! Guess it's time to go home!"
                "..."
                "...did I just get her number?"
                jump goodending_1
            else:   
                "...did you know that some pirahnas aren't fully carnivores?"
                "..."        
                "I hope I can see her again soon."
                jump goodending_2
        else:
            if they_swim==True:
                "Mink got up and simply patted me on the shoulder before heading off to her motorcycle."
                "..."        
                "And I was there alone, watching as the afternoon clouds drifted by."
                jump neutralending_1
            else:
                "You know, I meant what I said earlier.  About this having a romantic atmosphere."
                "..."      
                "And I'm left there alone, watching as the afternoon clouds drift by."
                jump badending_1
        
    label goodending_1:
    
        "ROMANTIC ENDING: Clear and her new girlfriend wear fabulous rainbow capes in the pride parade."
        
        return
        
    label goodending_2:
    
        "FRIENDSHIP ENDING: Clear and Mink become good friends.  Clear bonds well with Mink's flatmates."
        
        return
        
    label neutralending_1:
    
        "BORDERLINE ENDING: Clear fails to establish a deeper connection with Mink.  They're okay friends."
        
        return
        
    label badending_1:
    
        "BAD ENDING: Clear ends up with someone else while Mink watches from the sidelines.  Telling herself that she's okay with it becomes a useless strategy at some point."
        
        return    

dramaticaluniweeb
Newbie
Posts: 15
Joined: Sun Jun 12, 2016 1:28 am
Contact:

Re: Multiple endings?

#3 Post by dramaticaluniweeb »

Thank you for the quick reply! Using this code really helped, although I didn't use it exactly. Now I'm getting other errors, though, so I'll have to enter another forum. Thank you again!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], bonnie_641, GetOutOfMyLab