Page 1 of 1

Different Endings/options?

Posted: Tue Aug 06, 2013 5:27 pm
by Screewolf
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?

like:

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...

Re: Different Endings/options?

Posted: Tue Aug 06, 2013 6:21 pm
by Googaboga
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."
    
    menu:
        
        "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
        
    else: 
        
        call exploreend
        
    "The End."
    
    return
            
            
label insidepath:
    
    "I am inside."
    
    menu:
        
        "Read.":
            "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.
            
        "Draw.":
            "I love to draw."
            $ draw_points += 1

    return

label outsidepath:
    
    "I am outside."
    
    menu:
        
        "Play":
            "Playing is great."
            $ play_points += 1
            
        "Explore.":
            "Exploring is exciting."
            $ explore_points += 1
            
    return
    
    
label drawend:
    
    "I drew."
    
    return
    
label readend:
    
    "I read."
    
    return
    
label playend:
    
    "I played."
    
    return
    
label exploreend:
    
    "I explored."
    
    return
    
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.

Re: Different Endings/options?

Posted: Tue Aug 06, 2013 7:24 pm
by Talann
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?"
    
    menu:
        "Go outside":
            jump choice_outside
            
        "Stay inside":
            jump choice_inside
            
            
            label choice_outside:
                 e "Should I play today or explore?"
                 menu:
                     "explore":
                         jump choice_explore
                         
                     "play":
                         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?"
            menu:
                     "read":
                         jump choice_read
                         
                     "draw":
                         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:
            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:

Re: Different Endings/options?

Posted: Wed Aug 07, 2013 11:22 am
by OokamiKasumi
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