About branching and menus

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
Unknown

About branching and menus

#1 Post by Unknown » Fri Jan 22, 2010 12:06 am

Is there a way to make it to where you can have a menu in your game with two options but if you pick one the other choice will never be played through?

Like. Let's say you have a menue with two options, "a" and "b." Can you make it to where if you clicked "a" the script that follows "b" will not be played through eventually?

User avatar
AllegroDiRossi
Regular
Posts: 168
Joined: Mon Jul 27, 2009 9:42 pm
Tumblr: daroross
Deviantart: daroross
Location: New Mexico
Contact:

Re: About branching and menus

#2 Post by AllegroDiRossi » Fri Jan 22, 2010 12:56 am

You use label jumps.

In the same way that you would make a label jump for part A and part B,
you put a jump at the end of the part and make a label after both choices that you jump to when you complete the part.

Here's the code from The Question as an example.

Code: Select all


    s "Sure, but what's a \"visual novel?\""

menu:
    "It's a story with pictures.":
         jump vn

    "It's a hentai game.":
         jump hentai

label vn:
    m "It's a story with pictures and music."
    jump marry

label hentai:
    m "Why it's a game with lots of sex."
    jump marry

label marry:
    scene black
    with dissolve

    "--- years later ---"
If you choose the vn choice, you jump to the vn label
At the end of the vn label, you jump to the marry label
skipping the hentai label.

If you choose the hentai choice, you jump to the hentai label
skipping the vn label. At the end of the hentai label,
you jump to the marry label like normal.

That should illustrate what you need,
unless I misunderstood your question.
Live Life Heroically

User avatar
JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: About branching and menus

#3 Post by JinzouTamashii » Fri Jan 22, 2010 7:08 am

Also, if the user is adopting the child, don't forget to calculate weighted percentages.

The fans want achievements, ranks, guilds, inheritance systems from previous games... man, oh man!

Talk about a developer nightmare...
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Unknown

Re: About branching and menus

#4 Post by Unknown » Fri Jan 22, 2010 11:59 pm

Using your example as my own, allow me to clarify myself.

What I am asking is, like, could I have made it to where "vn" jumps to the "marry" label and "hentai" jumps to a completely different label? As if by clicking "hentai" you avoid both "vn" and "marry" altogether.

number473
Regular
Posts: 195
Joined: Tue Dec 15, 2009 4:20 am
Projects: The Duke's Daughter
Location: Cape Town
Contact:

Re: About branching and menus

#5 Post by number473 » Sat Jan 23, 2010 12:52 pm

You can do it, you can jump to any label that you like. If you don't want it to run through those other lables, then just put the new label at the end, or in a new file. I think the problem you may be running into is that Ren'py will go to the next label in sequence after the one that it is on. So you just need to arrange them in the way that'll give the result you want.
Mental weather report: Cloudy with a possibility of brain storms.

Post Reply

Who is online

Users browsing this forum: No registered users