Is there any way to create a personality quiz in Ren'Py?

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
Coranna
Newbie
Posts: 1
Joined: Mon Jun 25, 2018 9:00 pm
Organization: Jun'ai Entertainment
Location: Dallas, Texas, United States of America
Contact:

Is there any way to create a personality quiz in Ren'Py?

#1 Post by Coranna »

Hey guys. I'm new to these forums and new to Python. I'm currently working on a game in which the player needs to be sorted into a specific group based on their responses to a personality questionnaire. However, I can't find any tutorials on how to do this on Google. So, I thought I'd try here.

I greatly appreciate any help or suggestions, and thanks in advance.

- Coranna
“Make your life a masterpiece; imagine no limitations on what you can be, have or do." - Brian Tracy

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Is there any way to create a personality quiz in Ren'Py?

#2 Post by Per K Grok »

Coranna wrote: Thu Nov 22, 2018 10:34 pm Hey guys. I'm new to these forums and new to Python. I'm currently working on a game in which the player needs to be sorted into a specific group based on their responses to a personality questionnaire. However, I can't find any tutorials on how to do this on Google. So, I thought I'd try here.

I greatly appreciate any help or suggestions, and thanks in advance.

- Coranna
You could use a series of questions using menus where different answers adds our subtracts from the value of a variable. The final value of that variablewould then determine which group the player would belong to.

Code: Select all


default points=0

--------------

    menu q1:
        "Are you .... ?"
        "yes":
            $ points-= 1
        "Don't know":
            $ points-= 0
        "No":
            $ points+= 1

    menu q2:
        "Would you .... ?"
        "yes":
            $ points-= 1
        "Don't know":
            $ points-= 0
        "No":
            $ points+= 1

    menu q3:
        "Might you .... ?"
        "yes":
            $ points-= 1
        "Don't know":
            $ points-= 0
        "No":
            $ points+= 1

    if points<0:
        jump group 1
    elif points>0:
        jump group 2
    else:
        jump group 3
        


There are any number of variants you could do on this.
You could use more then one variable if you want to measure different things. You might send the player to a different second question depending on the answer to the first question. And so on ...

User avatar
CSV
Regular
Posts: 145
Joined: Sun Aug 31, 2014 6:58 pm
Tumblr: csvidaldraws
Deviantart: csvidal
itch: csvidal
Location: Portugal
Contact:

Re: Is there any way to create a personality quiz in Ren'Py?

#3 Post by CSV »

Here's another option for a quiz code! I used it once to make a 'Which character are you?' quiz for practice and I just didn't feel like keep tracking of the point scores myself.
I hope it helps!


Code: Select all

# The game starts here.
label start:
    $ TypeA = 0
    $ TypeB = 0
    $ TypeC = 0

    "Answer the questions honestly."    
    
label questions:    
    
    #####
    "Question 1."    
    menu:
        "Answer 1.":
            $ TypeA += 5
            pass
            
        "Answer 2.":
            $ TypeB += 5
            pass   
            
        "Answer 3.":
            $ TypeC += 5
            pass
 
    #####    
    "Question 2."
    menu:
        "Answer 1.":
            $ TypeA += 5
            pass
            
        "Answer 2.":
            $ TypeB += 5
            pass   
            
        "Answer 3.":
            $ TypeC += 5
            pass  
    
    #####    
    "Question 3."
    menu:
        "Answer 1.":
            $ TypeA += 5
            pass
            
        "Answer 2.":
            $ TypeB += 5
            pass   
            
        "Answer 3.":
            $ TypeC += 5
            pass  

##### Insert more questions here.
               
label results:

    "Now to know who you are..."
    
if TypeA > max(TypeB, TypeC):
    centered "Your personality is Type A!"
    return

elif TypeB > max(TypeA, TypeC):
    centered "Your personality is Type B!"
    return
     
elif TypeC > max(TypeA, TypeB):
    centered "Your personality is Type C!"
    return
    
elif TypeA == TypeB or TypeA == TypeC or TypeB == TypeC:
    centered "Your result was a tie. Please answer one more question to get your result!"
    jump extraquestion

else:
    centered "ERROR! Something went wrong; please try again!"
    return


##### Tie breaker question.

label extraquestion:

    "Extra question."
    menu:
        "Answer 1.":
            $ TypeA += 5
            jump results
            
        "Answer 2.":
            $ TypeB += 5
            jump results 
            
        "Answer 3.":
            $ TypeC += 5
            jump results  

    #####
☆☆☆
(portfolio)
☆☆☆☆☆☆☆☆☆

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Sirifys-Al, Zapor