Different Endings/options?

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
Posts: 4
Joined: Fri Aug 02, 2013 11:16 pm

Different Endings/options?

#1 Post by Screewolf » Tue Aug 06, 2013 5:27 pm

So this is one of my biggest questions. I have an options menu come up after something happens, is this program able to have a game with different endings?

Say like this

Go outside
Stay inside

two basic options, if you go outside the game would go much differently than staying inside.

Is there something you can do like have the game say If you clicked on "go outside" you jump to an outside scene and go throughout the game that way. If you clicked "Stay inside" you stay inside and different things happen for the rest of the game.

I am aware if the program is able to do this it will take a lot of work.

Also I would need to have a lot of branches I guess thats what you would call them?


Start: - go outside -Stay inside
(outside option1)Play (outside option2)explore
(inside option 1)read (inside option 2)draw
(outside-play)ending 1 (outside-explore)ending 2 (Inside-read)ending 3 (Inside-draw)ending 4

I dont know codes for this at all.
Thank you to anyone who helps me with this...

User avatar
Eileen-Class Veteran
Posts: 1383
Joined: Wed Dec 12, 2012 1:37 pm
Completed: https://gbpatch.itch.io/
Projects: Floret Bond, XOXO Blood Droplets, Our Life
Organization: GB Patch Games
Tumblr: gb-patch
itch: gbpatch

Re: Different Endings/options?

#2 Post by Googaboga » Tue Aug 06, 2013 6:21 pm

Yeah you can do that. Something like this would work:

Code: Select all

label start:
#You have to define points ahead of time if you want to use them in your game.
    $ read_points = 0
    $ draw_points = 0
    $ play_points = 0
    $ explore_points = 0
    "The game has started."
        "Stay inside.":
            call insidepath
        "Go outside.":
            call outsidepath
#You call the outside or inside path and when those are over it comes back here and moves into the ending.
    "This is the end of the game."
    if play_points > max(read_points, explore_points, draw_points):
        call playend
    elif read_points > max(play_points, explore_points, draw_points):
        call readend
    elif draw_points > max(play_points, explore_points, read_points):
        call drawend
        call exploreend
    "The End."
label insidepath:
    "I am inside."
            "Reading is fun."
            $ read_points += 1
#If these outcome of these choices are long you can create another label and call that instead of writing it all here.
            "I love to draw."
            $ draw_points += 1


label outsidepath:
    "I am outside."
            "Playing is great."
            $ play_points += 1
            "Exploring is exciting."
            $ explore_points += 1
label drawend:
    "I drew."
label readend:
    "I read."
label playend:
    "I played."
label exploreend:
    "I explored."
But there are other ways to do it as well. Like if the game is very simple you may not need labels and points. You can just put everything directly under the menu choices. It will probably be pretty cluttered so points and labels are a better option though. When it comes to points you can determine an ending like I did by saying whatever has the most points wins no matter how few points they have. Or you can have the ending be decided by requiring at least a certain amount of points for an ending to happen. Also the "call" feature I used in my example brings a certain scene up to that part of the code. You can instead use the "jump" feature to bring the code to a different spot. That is more useful in certain situation than the call feature. Especially if you want to skip past a certain scene.

Really what you want to do depends on how your game is going to work. If your game isn't as simple as this inside/outside game you will probably have to switch things up in some aspects.

I hope this isn't too hard to understand. I just don't want to give you the impression that my example is the only way for this sort of thing to work.
Floret Bond, XOXO Blood Droplets, Our Life
A Foretold Affair, My Magical Divorce Bureau, XOXO Droplets, Lake of Voices

User avatar
Posts: 132
Joined: Thu May 09, 2013 12:02 pm
Projects: Shooting Stars, REBORN

Re: Different Endings/options?

#3 Post by Talann » Tue Aug 06, 2013 7:24 pm

Yes, it is possible - although, it may take a lot to get your head around it and it will be confusing. Trust me, I've been through it all and have screwed up a lot. Here is one advice, before trying to put some kind of new code that you aren't used to, make a "Test" project, and put the code in that project then see for yourself if it works or not. That way, you won't be able to ruin your real project.

As Googaboga mentioned, there's this way to do it which involves points. But, there is also this other way to do it (you will need to be very, and I mean very accurate with your blocks), which is, easier if you're new to coding - and the points might confuse you. (I normally use the method that Googaboga has showed however, this one might be easier, I don't know.)
Okay let's start:

Code: Select all

# You can place the script of your game in this file.

# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")

# The game starts here.
label start:

    e "Should I go outside or just stay inside today?"
        "Go outside":
            jump choice_outside
        "Stay inside":
            jump choice_inside
            label choice_outside:
                 e "Should I play today or explore?"
                         jump choice_explore
                         jump choice_play
                         label choice_explore:
                             e "You got the 1st Ending 'Outside-Explore' "
                             jump choice_return
                         label choice_play:
                             e "You got the 2nd Ending 'Outside-Play' "
                             jump choice_return
            label choice_inside:
                e "Should I read today or draw?"
                         jump choice_read
                         jump choice_draw
                         label choice_draw:
                             e "You got the 3rd Ending 'Inside-Draw' "
                             jump choice_return
                         label choice_read:
                             e "You got the 4th Ending 'Inside-Read'"
                             jump choice_return
    label choice_return:
So yeah, you will just need to clear it up with the 'Return Choice'. Oh, by the way, you should copy both mine, and Googaboga's method and paste it in a project like I mentioned earlier and call it 'Test', to see which one is easier for you. Hope I am not confusing you a lot, and good-luck! :wink:

User avatar
Eileen-Class Veteran
Posts: 1775
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA

Re: Different Endings/options?

#4 Post by OokamiKasumi » Wed Aug 07, 2013 11:22 am

Screewolf wrote:So this is one of my biggest questions. I have an options menu come up after something happens, is this program able to have a game with different endings...?
For a good tutorial that explains how to do all these things simply, but thoroughly, and with examples, go here: How to Make a Simple Otome Game
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot], Rnot2000