Branching Help

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
undertone
Newbie
Posts: 5
Joined: Sun Dec 14, 2008 3:55 pm
Contact:

Branching Help

#1 Post by undertone » Sun Dec 14, 2008 4:11 pm

Okay, so I am at a point where I need to branch the game, and the documentation is too vague for me.

Here is the script
"I hesitated. Should I keep going, pretending to ignore the person, or should I turn around and ask him to stop following me."

menu:
"Keep Walking":

"Its just my brain playing tricks on me."
"I kept walking, maybe I'm just being paranoid."
"As I made it to the store, walking inside, the man went by, only giving a quick glance on the way."


"Confront the Man"
"It isn't an illusion."
"I turned around, giving the man a jump."
"In Japanese he said."
m "Shit, does he know?"
l "Ahha! So I was right! You are following me!"
m "You speak Japanese?! Oh crap."
"He bolted, having cleary failed his mission, whatever it was."

I want to make it where each one ends up getting to a different point. For example, confronting the man should result in a different script like
"It turns out that I was being followed, which started this whole journey I am on now. After that day, I realized that I wasn't safe..." Yada yada, and that will start its own scenario.
While the other will begin its own scenario. So I'm basically writing two stories after the branch. What do I do?

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Branching Help

#2 Post by monele » Sun Dec 14, 2008 5:14 pm

You're actually on the right way.

But first, when posting code examples on the forums, try using the code tags :

Code: Select all

[code]my code here
[/code]
Most importantly, it will show indentation which is important with menus.

Now a simple inline menu example :

Code: Select all

menu:
    "My first choice":
        "Description of what happens."
    #
    "My second choice":
        "Description of what happens."
    #
#

"The story resumes."
Each choice will end up joining back to "The story resumes" unless you include a "jump" command in them. This is good when you need short branchings that go back to the same path.

Now for a menu with jump example :

Code: Select all

label start:
    
    ## Some stuff happens, leading to the choice

    menu:
        "My first choice":
            jump firstchoice
        #
        "My second choice":
            jump secondchoice
        #
    #
#

label firstchoice:
    "Whatever happens here."
#

label secondchoice:
    "Whatever happens here."
#
Here, we know each choice will lead to totally different paths and won't rejoin (or at least not for a while), so instead of having hundreds of indented lines within the menu, we put a simple "jump", leading to new labels... which are described below the menu.

undertone
Newbie
Posts: 5
Joined: Sun Dec 14, 2008 3:55 pm
Contact:

Re: Branching Help

#3 Post by undertone » Sun Dec 14, 2008 8:44 pm

sank you, I'll post back if I have anymore questions

Post Reply

Who is online

Users browsing this forum: Google [Bot], Zichfried