Multiple choices and remembering them

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
User avatar
Hi.In.Ni
Regular
Posts: 103
Joined: Fri Mar 04, 2016 4:12 pm
Contact:

Multiple choices and remembering them

#1 Post by Hi.In.Ni »

Hi. So I'm currently developing and entry for NaNo2016 and I'm having trouble with making paths using multiple choices and remembering them.

My game has a single choice, which has 3 answers depending on the character you want to intimate with.
I tried using
menu:
"Hime":
jump choice1_yes

"Haru":
jump choice2_yes

"Yui":
jump choice3_yes
and then doing this:
label choice1_yes:

$ menu_flag = True

scene bg cr

show hime talk

hime "Hello!"
yuu "Hello."
but this leads to the next choices playing inmediately after the first one is done, and i dont know how to prevent that. I also tried adding "jump choice1_done" according to every single one but i get the error "could not find label 'choice2_done'.

On the other hand, I want that once you reach the end of each choice, it goes back to options so you can choose the next one you want, since the game requires you to finish the 3 choices before getting to the ending.
And I really dont know how to do the whole "Go back to the choices" and "remember the choices" thing.


I hope you guys can help me, thank you.
Please, check my NaNoRenO entry!
That was easy!! [NSFW] [BxG/B] [NaNoRenO2016]
http://lemmasoft.renai.us/forums/viewto ... 50&t=37491

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Multiple choices and remembering them

#2 Post by Steamgirl »

There are a few different ways of doing this. But what you're probably missing is a "jump" at the end of your sequence to stop ren'py running through them in sequence.

So like this

Code: Select all

    show hime talk

    hime "Hello!"
    yuu "Hello."
    jump choice1_done
If it's saying it can't find "choice2_done" then you probably wrote the label name wrong? (used 2 instead of 1)

Here is an alternative demonstrating how you can remember choices:

Code: Select all

    menu:
        "Hime":
            $ first_choice = 1
            yuu "I choose Hime!"
        "Haru":
            $ first_choice = 2
            yuu "I choose Haru!"
        "Yui":
            $ first_choice = 3
            yuu "I choose Yui!"

    scene bg cr

    if first_choice is 1:
        show hime talk
        hime "Hello!"

    elif first_choice is 2:
        show haru talk
        haru "Hello!"

    elif first_choice is 3:
        show yui talk
        yui "Hello!"

    else:
        "Oops, you shouldn't be seeing this."

    yuu "Hello."
EDIT: I really shouldn't do this right before bed. I'll try to remember to answer the other questions you had when I get up tomorrow, if no one else does so before then.

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Multiple choices and remembering them

#3 Post by Steamgirl »

Argh! I had written a long and comprehensive post but lost it! And now I'm out of time.

I hope the script below helps you. The thing to remember is that variables can have any name and be set to anything, letters, numbers, or True/False so...

$ character1 = "Hime"
$ whatever = 1
$ another_variable = True

So any of the variable names I use (such as option1_1) can be called whatever you like!

Anyway, the script below should give you a menu with 3 choices and once you've seen all 3 it continues the story. Put it somewhere after the "start" label.

Let me know if you run into any snags or if anything is confusing. ^_^
Good luck with NaNoRenO!

-Steamgirl

Code: Select all

    #First we set a default value for our variables, so that when we check whether we've seen a choice, we know it will be right
    $ option1_1 = False
    $ option1_2 = False
    $ option1_3 = False

label choice1_menu:

    #If any of our options haven't been seen yet, we show the menu
    if option1_1 is False or option1_2 is False or option1_3 is False:

        menu:
            "Make a choice. Pick a different one each time."
            "Option 1":
                #We memorise that this option has been seen
                $ option1_1 = True
                #then jump to Hime or whoever
                jump choice1_1
            "Option 2":
                $ option1_2 = True
                jump choice1_2
            "Option 3":
                $ option1_3 = True
                jump choice1_3
    
    #Otherwise we continue the game
    else:
        jump after_choice1

#The Hime scene or whoever
label choice1_1:
    "You chose option 1."
    "Insert interesting scene here."
    #We jump back to the menu
    jump choice1_menu

#Some other scene
label choice1_2:
    "You chose option 2."
    "Imagine what amazing stuff you could read here."
    jump choice1_menu
    
#And a third scene - Yui was it?
label choice1_3:
    "You chose option 3."
    "Strawberry sundae. Because it's sunny and I fancy it right now."
    jump choice1_menu
    
label after_choice1:
    "We have seen all options and can now continue the game."
    "Hope you were amazed by the amazingly imaginative scenes and strawberry sundae!"

Post Reply

Who is online

Users browsing this forum: No registered users