Unique Dialogue for Player Choices?

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
loneroanpegasus
Newbie
Posts: 3
Joined: Sat May 21, 2016 1:07 pm
Projects: Nelson's Finest
Organization: Lone Roan Pegasus Games
Deviantart: tajmajaj
Location: Devon, UK
Contact:

Unique Dialogue for Player Choices?

#1 Post by loneroanpegasus » Sat May 21, 2016 1:33 pm

Hello folks, I'm a total newcomer to Ren'Py and Python, but I'm well under-way making my first game. At the moment it's really simple and I'm just working through the dialogue, getting to grips with making in-game menus, and I wondered how you would go about creating unique dialogue for a particular choice a player has made?

Just as an example, I've tried the approach the tutorial suggests:

Code: Select all

menu:
    "Yes, I do.":
        jump choice1_yes
        
    "No, I don't.":
        jump choice1_no
        
label choice1_yes:
    
    $ menu_flag = True
    
    e "While creating a multi-path visual novel can be a bit more work, it can yield a unique experience."
    
    jump choice1_done
    
label choice1_no:
    
    $ menu_flag = False
    
    e "Games without menus are called kinetic novels, and there are dozens of them available to play."
    
    jump choice1_done
    
label choice1_done:
    
    #...the game continues here.
Whilst this is fine, it's not complex enough for what I want. I've tried different approaches but to no avail. If I have something more complex than simply a binary choice of what is basically 'yes' or 'no', then how do I go about linking in player's choices?

For example, at the beginning of my game the player selects background choices. The first set of 4 choices are about what the player's father did for a living. The player selects, for example, barrister. In the next 4 set of choices, the player determines what their character did during their youth. If they selected 'causing trouble', I would like to be able to link in a bit of dialogue unique to the player who selected the option of barrister. I hope that makes sense lol! :lol:

Any help would be appreciated because then I can move on with my project!

User avatar
Darim
Regular
Posts: 67
Joined: Sun Jun 21, 2015 4:17 pm
Organization: Setsuna Ken
Github: SetsunaKen
Location: Germany
Contact:

Re: Unique Dialogue for Player Choices?

#2 Post by Darim » Sat May 21, 2016 3:13 pm

You can try to add more complexity with If, elif, else conditions like:

Code: Select all

label start:

    "What is your fathers background?"
menu:
    "He is Fighter":
        $father_is_fighter = True
        jump choice_two

    "He is a Barrister":
        $father_is_barrister = True
        jump choice_two

label choice_two:

    e "Oh I see."

    if father_is_fighter: #if father_is_fighter == true <-- This is the long version
        e "So your Father is a Fighter."
    elif father_is_barrister: #if father_is_barrister == true
        e "So your father is a Barrister."

    e "Tell me a litte bit about you."

menu:
    "I'm a troublemaker":
        $troublemaker = True
        jump end
    "I love trains.":
        $train_love = True
        jump end

label end:
    e "Okay."

    if father_is_fighter and troublemaker: #if father_is_fighter == true and troublemaker == true
        e "Dialog Dialog...."
    elif father_is_fighter and train_love:
        e "Another Dialog Dialog..."
    elif father_is_barrister and troublemaker:
        e "Dialog Dialog...."
    elif father_is_barrister and train_love:
        e "Dialog Dialog...."

    "The End."

    return

Last edited by Darim on Sat May 21, 2016 3:26 pm, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Unique Dialogue for Player Choices?

#3 Post by xavimat » Sat May 21, 2016 3:16 pm

Well, these are pretty basic things. Please, study the Quickstart in the Documentation, specially the sections:
- about labels and jumps https://www.renpy.org/doc/html/quicksta ... -and-jumps
- and the branching with if-statements https://www.renpy.org/doc/html/quicksta ... statements
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

loneroanpegasus
Newbie
Posts: 3
Joined: Sat May 21, 2016 1:07 pm
Projects: Nelson's Finest
Organization: Lone Roan Pegasus Games
Deviantart: tajmajaj
Location: Devon, UK
Contact:

Re: Unique Dialogue for Player Choices?

#4 Post by loneroanpegasus » Sat May 21, 2016 3:46 pm

Thanks for the clarification guys. I know it's pretty basic stuff but like I said, I am literally brand, BRAND new to this stuff and I couldn't find any documentation anywhere for that task specifically, so thanks for that.

At least I can move on with the story now. :)

loneroanpegasus
Newbie
Posts: 3
Joined: Sat May 21, 2016 1:07 pm
Projects: Nelson's Finest
Organization: Lone Roan Pegasus Games
Deviantart: tajmajaj
Location: Devon, UK
Contact:

Re: Unique Dialogue for Player Choices?

#5 Post by loneroanpegasus » Sat May 21, 2016 4:27 pm

Ok, super-thanks to you Darim - I slightly tweaked what you showed me and got it working for my game. It didn't work at first and I got worried, but with proper indentation and a bit of uneducated fiddling on my part got it going. I bow to you sir/madam! :mrgreen:

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]