I'm trying to code a specific quiz mini game? [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
Queenofwands
Newbie
Posts: 3
Joined: Wed Jul 24, 2019 1:34 pm
Contact:

I'm trying to code a specific quiz mini game? [SOLVED]

#1 Post by Queenofwands » Wed Jul 24, 2019 2:06 pm

In my game, in the beginning, I want there to be a quiz. This quiz determines which character you'll chase romantically through the whole game.

So if you choose a bunch of billy answers, you'll end up with billy chapter 1 and so on. I think I saw the code for quizzes but nothing like this. Any help would be really appreciated! :)
Last edited by Queenofwands on Wed Jul 24, 2019 4:09 pm, edited 1 time in total.

dellcartoons
Regular
Posts: 26
Joined: Sat Jul 13, 2019 3:35 pm
Contact:

Re: Please help, I'm trying to code a specific quiz mini game?

#2 Post by dellcartoons » Wed Jul 24, 2019 2:29 pm

Something like this?

Code: Select all

default love_billy = False
default love_dee_williams = False

define billy = 0
define mandy= 0
define jack= 0
define joel= 0
define dee_williams = 0

menu:
       "Question 1: Billy or Mandy?"

       "Billy":
            $ billy+= 1

       "Mandy":
            $ mandy += 1

menu:
       "Question 2: Billy or Jack?"

       "Billy":
            $ billy+= 1

       "Jack":
            $ jack+= 1

menu:
       "Question 3: Billy or Joel?"

       "Billy":
            $ billy+= 1

       "Joel":
            $ joel+= 1

If billy >= 3:
        $ love_billy = True
        jump billy_chapter
else:
       "I guess you just don't love Billy enough!"
       jump die_alone_and_miserable
If you have a later chapter w/ two or more characters you can have something like:

Code: Select all

"Hey, there's Billy and Dee Williams!"

menu:
     "Say hi to Billy." if love_billy:
     $ billy += 2
     
     "Say hi to Dee Williams." if love_ dee_williams:
     $  dee_williams+= 2

    "Nod to Billy and Dee Williams.":
    $ billy += 1
    $ dee_williams += 1

    "Punch Billy in the face." if billy <1:
    $ billy -= 1
    $ dee_williams += 1

    "Run away and hide.":
     jump die_alone_and_miserable


Queenofwands
Newbie
Posts: 3
Joined: Wed Jul 24, 2019 1:34 pm
Contact:

Re: Please help, I'm trying to code a specific quiz mini game?

#3 Post by Queenofwands » Wed Jul 24, 2019 4:04 pm

Thank you so much! Just tested it out and it works like a charm! :)

I just had to put the right indents and spaces.

dellcartoons
Regular
Posts: 26
Joined: Sat Jul 13, 2019 3:35 pm
Contact:

Re: I'm trying to code a specific quiz mini game? [SOLVED]

#4 Post by dellcartoons » Wed Jul 24, 2019 4:19 pm

Glad to help


Post Reply

Who is online

Users browsing this forum: Google [Bot]