Affection point? (SOLVED)

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
macaron
Regular
Posts: 31
Joined: Sat Mar 30, 2013 4:16 am
Contact:

Affection point? (SOLVED)

#1 Post by macaron » Sun Jul 14, 2013 1:11 pm

I saw some other codes such as
Point = 0 and so on
But how do you use it? As in how do you apply it in each and every choice.
Also in the end after all the points stuff how can I make it lead to the character that one should end with?
Last edited by macaron on Mon Jul 15, 2013 2:17 am, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Affection point?

#2 Post by trooper6 » Sun Jul 14, 2013 1:43 pm

Some of the answer to that question is a coding one...which is pretty easy to answer. Here is one way to do it.

Code: Select all

# The game starts here.
label start:    
            
    #declare all the variables for your game
    $ betty_points = 0
    $ veronica_points = 0

     "Who will Archie find love with?."
    
    #You set up your first choice in the game    
    menu:
       "Who do you ask to have a malted with you at the diner?"
        "BETTY":
            $ betty_points += 1
            "You have a lovely date with Betty at the diner."
        "VERONICA:":
            $ veronica_points += 1
            "You have a lovely date with Veronica at the diner."

    #You set up your second choice in the game    
    menu:
       "Do you prefer blondes or brunettes?"
        "BLONDES":
            $ betty_points += 1
            "You have always found blondes to be more fun."
        "BRUNETTES:":
            $ veronica_points += 1
            "You have always found brunettes to be more fun."

    #You set up your third choice in the game    
    menu:
       "What is more important to you, dating a woman who is rich or dating a woman who likes to work on cars?"
        "CARS":
            $ betty_points += 1
            "You want to date a woman who is very, very rich.."
        "RICH:":
            $ veronica_points += 1
            "You want to date a woman who can fix your car."

    #You do the ending part. You check which person has more points and then give the appropriate replay
    if betty_points > veronica_points:
        "You find true love with Betty and go to the prom with her!"
    else:
        "You find true love with Veronica and go to the prom with her!"

    return
But that code is the easy part. The part that takes more time is deciding what sort of choices you want to have in your game and how you want those choices to affect how your endings will be. That is the writing part.

As a tip, keep track of all your decision points somewhere so you can make sure that you know what is happening in your game. For example, the code I wrote works because I know there are 3 choices...which means there can never be a tie between Betty and Veronica. If I have only provided 2 choices...the final score possibilities would be: Betty 2, Veronica 0; Betty 0, Veronica 2; Betty 1, Veronica 1. In that last instance we have a tie. So I would have needed to write something like this at the end:

Code: Select all

    #You do the ending part. You check which person has more points and then give the appropriate replay
    if betty_points > veronica_points:
        "You find true love with Betty and go to the prom with her!"
    elif veronica_points > betty_points:
        "You find true love with Veronica and go to the prom with her!"
    else:
        "Just like every other time, you just can't make up your mind between the two women. So you decide to string them both along like you always do. You come up with some caper where you go to the prom with both of them without telling them and run around changing jackets all the time. Jughead helps you out, of course. Hijinks ensue. In the end, they both find out about it and, tired of your ridiculousness, they both dump you and decide to date each other."
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
macaron
Regular
Posts: 31
Joined: Sat Mar 30, 2013 4:16 am
Contact:

Re: Affection point?

#3 Post by macaron » Mon Jul 15, 2013 1:19 am

trooper6 wrote:Some of the answer to that question is a coding one...which is pretty easy to answer. Here is one way to do it.

Code: Select all

# The game starts here.
label start:    
            
    #declare all the variables for your game
    $ betty_points = 0
    $ veronica_points = 0

     "Who will Archie find love with?."
    
    #You set up your first choice in the game    
    menu:
       "Who do you ask to have a malted with you at the diner?"
        "BETTY":
            $ betty_points += 1
            "You have a lovely date with Betty at the diner."
        "VERONICA:":
            $ veronica_points += 1
            "You have a lovely date with Veronica at the diner."

    #You set up your second choice in the game    
    menu:
       "Do you prefer blondes or brunettes?"
        "BLONDES":
            $ betty_points += 1
            "You have always found blondes to be more fun."
        "BRUNETTES:":
            $ veronica_points += 1
            "You have always found brunettes to be more fun."

    #You set up your third choice in the game    
    menu:
       "What is more important to you, dating a woman who is rich or dating a woman who likes to work on cars?"
        "CARS":
            $ betty_points += 1
            "You want to date a woman who is very, very rich.."
        "RICH:":
            $ veronica_points += 1
            "You want to date a woman who can fix your car."

    #You do the ending part. You check which person has more points and then give the appropriate replay
    if betty_points > veronica_points:
        "You find true love with Betty and go to the prom with her!"
    else:
        "You find true love with Veronica and go to the prom with her!"

    return
But that code is the easy part. The part that takes more time is deciding what sort of choices you want to have in your game and how you want those choices to affect how your endings will be. That is the writing part.

As a tip, keep track of all your decision points somewhere so you can make sure that you know what is happening in your game. For example, the code I wrote works because I know there are 3 choices...which means there can never be a tie between Betty and Veronica. If I have only provided 2 choices...the final score possibilities would be: Betty 2, Veronica 0; Betty 0, Veronica 2; Betty 1, Veronica 1. In that last instance we have a tie. So I would have needed to write something like this at the end:

Code: Select all

    #You do the ending part. You check which person has more points and then give the appropriate replay
    if betty_points > veronica_points:
        "You find true love with Betty and go to the prom with her!"
    elif veronica_points > betty_points:
        "You find true love with Veronica and go to the prom with her!"
    else:
        "Just like every other time, you just can't make up your mind between the two women. So you decide to string them both along like you always do. You come up with some caper where you go to the prom with both of them without telling them and run around changing jackets all the time. Jughead helps you out, of course. Hijinks ensue. In the end, they both find out about it and, tired of your ridiculousness, they both dump you and decide to date each other."
Thank you thank you thank you so much XD
I even enjoy going through the codes cause you used Archie's characters to make an example.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], khezo, span4ev, _ticlock_