Page 1 of 1

Script-writing and plot-branching

Posted: Thu Sep 29, 2011 4:29 pm
by PockieHoshi
Sorry if this question sounds stupid but,
I was wondering,How do you go about making a branching,multi-pathed game on ren'py?
I mean its TOTALLY confusing :? ! I'm not exactly a genius at programming and coding things :cry: .
Also,Are there any codes for this? Any specific way of going about doing this?

Please explain it as simply as possible :|

Thank you!

Re: Script-writing and plot-branching

Posted: Thu Sep 29, 2011 4:47 pm
by Camille
You'll want to read about menus, labels, and jumps as well as remembering user choices. That's about all you need to know in order to make a branching, multi-path game.

Re: Script-writing and plot-branching

Posted: Thu Sep 29, 2011 4:50 pm
by cloudyssky
Having a game end in multiple ways is actually pretty easy. Yes, there's coding for ending a game, but you have to do all the work!

Here's a quick example:

Code: Select all

label start:
    a "Hey let's get married!"
    menu:
        "Okay!":
            jump married
            
        "No!":
            jump single
            
label married:
    a "We got married!"
    "Good Ending."
    return

label single:
    a "We didn't get married! A shame!"
    "Bad ending"
    return

What creates an ending is "return". That function ends the game. A game can have dozens and dozens of different endings. All you need is "return" where you want the game to end.

Re: Script-writing and plot-branching

Posted: Fri Sep 30, 2011 7:19 am
by PockieHoshi
Camille wrote:You'll want to read about menus, labels, and jumps as well as remembering user choices. That's about all you need to know in order to make a branching, multi-path game.
I've just read up on both things and it actually seems pretty simple lol (^o^)/ Thank you! :)
cloudyssky wrote:Having a game end in multiple ways is actually pretty easy. Yes, there's coding for ending a game, but you have to do all the work!

Here's a quick example:

Code: Select all

label start:
    a "Hey let's get married!"
    menu:
        "Okay!":
            jump married
            
        "No!":
            jump single
            
label married:
    a "We got married!"
    "Good Ending."
    return

label single:
    a "We didn't get married! A shame!"
    "Bad ending"
    return

What creates an ending is "return". That function ends the game. A game can have dozens and dozens of different endings. All you need is "return" where you want the game to end.
Thank you so much for posting an example :o ! I think I sort of understand how to go about doing this now.
Thank you :lol: !

Re: Script-writing and plot-branching

Posted: Tue Oct 04, 2011 12:00 pm
by gaoldart
You could use a point system. With a variable like:

Code: Select all

$ girl1_points = 0
then girl1 has no points but if you add something like...

Code: Select all

    "girl1" "What to do...?"

    menu:
        "Do nothing":
            girl1_points = +1
(Someone correct me if the code is wrong) But this means that girl1 now has +1 point

You could later put something on the lines of:

Code: Select all

    if girl1_points = x:
                  jump girl1end
If anybody can correct me please do so... but that's the basic idea

Re: Script-writing and plot-branching

Posted: Tue Oct 04, 2011 3:12 pm
by PockieHoshi
gaoldart wrote:You could use a point system. With a variable like:

Code: Select all

$ girl1_points = 0
then girl1 has no points but if you add something like...

Code: Select all

    "girl1" "What to do...?"

    menu:
        "Do nothing":
            girl1_points = +1
(Someone correct me if the code is wrong) But this means that girl1 now has +1 point

You could later put something on the lines of:

Code: Select all

    if girl1_points = x:
                  jump girl1end
If anybody can correct me please do so... but that's the basic idea
Point system :o ?
I'd actually hadn't heard of that,thanks for mentioning it ^-^!
That actually looks alot simpler than the labels and such :lol: . (probably easier to code too)
So does it function similarly like the labels and jumps or is there some sort of difference between them?
Please explain it a bit more if you can (sorry if I'm asking for too much) :oops: .

Thank you! =]

Re: Script-writing and plot-branching

Posted: Tue Oct 04, 2011 3:26 pm
by gaoldart
Well for starters you have this: http://lemmasoft.renai.us/forums/viewto ... f=8&t=4205

And as far as i know, you still need the labels...

Code: Select all

    menu:
        "Do nothing":
            $ girl1_points += 1
            jump nextscene
Please note that i was wrong is += 1 not = +1

And you continue there, later you can put up a road cone like:

Code: Select all

if girl1_points >= 10:
    jump goodend
else:
    jump bad end
The code adds to the points you put in the choice, but as a menuitem it still needs somewhere to jump to, so you need to put up a label for the choice.

You can also put it as part of the script so the points add thanks to the story. Just put them like you would put any line

It is still a bit more simple than to depend on flags...

If you get any problems, PM me and i might help you, unless you find a better answer, then i might need help from you