Eventing a Quiz System with random, non-repeatable questions

Discussion in 'RMVX Ace Tutorials' started by Sixth, Aug 20, 2014.

  1. Sixth

    Sixth Veteran Veteran

    Likes Received:
    First Language:
    Primarily Uses:

    Quiz Systems are a pretty common aspects of RPGs.
    They are mostly optional things to accomplish, but regardless, perfectionist gamers, such as me, will want to finish them too.

    It is also a good way to keep the players in the game a bit longer, by making them read random books, collect information from random people, just to get another answer for a question from the quiz.

    Most of these Quiz Systems are a collection of questions about in-game history, items and characters.
    But there can be other things mixed in, of course.
    One perfect example that comes to my mind is the Quiz-like mini-game from Tales of Destiny.

    Anyway, I will (try) to explain how can that system be evented in this topic.

    First of all, the "requirements":
    # To understand this system, you need to have the following things:
    # - Basic eventing knowledge
    # - Knowledge about switches and their operations
    # - Knowledge about self-switches and their operations
    # - Knowledge about variables and their operations
    # - Knowledge about (nested) conditional branches and their usage
    # - Knowledge about loop commands
    # - Knowledge about the used scripts in the demo and knowing their functional
    #   usage in practice (optional)
    # - A careful read-through for all comments made in the events itself
    #   (some of them are repetitive)
    # - A careful read-through of the instructions in this post (which can be found
    #   in the demo too on the script list)
    When all of the things above are checked, it is time to get down to business!

    Setting the system up:
    # I will explain the actual question setup and the ending phase here only, as
    # that is the only thing which really needs explanation.
    # It is up to you how to use this new-found knowledge!
    # 1. Create the event.
    #    Can't make anything happen in the game without those, right?
    # 2. We will start with setting up our variables and switches for the system.
    #  ~ Variable setup:
    #  - The first variable will be the 'Question Randomizer'. This will make the
    #    questions appear at random instead of the order at which we create them in
    #    the event.
    #  - The second variable will be the 'Questions Asked'. This will record the
    #    number of questions asked. You can define how many questions the player
    #    needs to answer before the evaluation/results scene with this variable.
    #  - The third variable will be the 'Correct Answers'. This will record the
    #    number of correct answers given in a finished quiz mini-game.
    #    Optionally, there can be more/other variables which could record points,
    #    for example, for some kind of point system, etc.
    #    These optional variables will operate the same as our 'Correct Answers'
    #    variable, so for the sake of simplicity, I will use one variable for this.
    #  ~ Switch setup:
    #  - Without using any external scripts, we need the same amount of switches
    #    as the amount of questions we prepared for the system.
    #    Seeing as the whole point of this system is to properly randomize the
    #    questions and to eliminate the possibility of the questions repeating,
    #    I guess, it is safe to say that the maker needs at least 20 switches
    #    reserved for this or more.
    #    These switches will be the "question eliminators", which means that these
    #    will control the questions, so that a question which appeared already will
    #    not be able to appear again until the quiz mini-game is finished and reset.
    #  - Depending on how we trigger the 'Ending Phase' we might need another switch
    #    to be reserved. We will name this switch as the 'Ending Phase'.
    # 3. Time to start with the actual event making!
    #    We will make our question page now!
    #    The page should be set to 'Autorun' at the 'Trigger' settings!
    # - 1. We will start with a loop command.
    # - 2. Inside the loop, make a 'Control Variables' command.
    #      The variable which you will need to set up here is the 'Question Randomizer'.
    #      Set this variable to a random value between 0 and the number of questions
    #      you prepared for the quiz system minus 1!
    #      So if you got 20 questions, you need to set this variable to a random
    #      value between 0 and 19!
    #      When I say "set it to a random value" I mean that you need to use the
    #      'Random' operand on the 'Control Variables' box and the operation should
    #      be set to 'Set'. Wow, now this last part sounds weird.
    # - 3. After this variable operation, we need to make a 'Conditional Branch'
    #      command. This conditional branch should check for a variable.
    #      The variable will be the 'Questions Asked' variable. The range of the check
    #      should be set to 'Equal to'. And the number used should be set to the
    #      number of questions you want to ask from the player before the quiz ends.
    #      So, if you want to ask the player 10 random questions from 20, for example,
    #      you should set the number to 10.
    #      Make sure to enable the 'Set handling when conditions do not apply' option!
    # - 4. In the 'condition is true' part (which is above the 'Else' part from our
    #      conditional branch made) you have two options to use:
    #      You can either turn ON a self-switch if you got a spare one, or you could
    #      turn ON a switch. For the sake of simplicity, I will use a switch here
    #      and will name it 'Ending Phase'.
    # - 5. After the switch operation, we need to make a 'Break Loop' command.
    #      If you forget to make this command, your game will be stuck in a
    #      never-ending quiz question bombarding, so do not forget it!
    # - 6. Time to hop onto the other side of our conditional check! Our next command
    #      goes below the 'Else' part of the conditional branch command we made.
    #      Here comes another 'Conditional Branch' command! We will use another
    #      variable to be checked here, namely our 'Question Randomizer' variable.
    #      This check will be responsible for the randomization of the questions
    #      in the quiz system.
    #      The range is 'Equal to', the number used at our first question is 0.
    #      For every following question, you need to add +1 to this number for the
    #      check! So, for the first question, we check for 0, for the second
    #      question we will check for number 1, for the third we will check for 2,
    #      and so on to the infinity and beyond!
    #      But first, let's finish our first question, shall we?
    #      Ohh, and we don't need the 'Set handling when conditions do not apply'
    #      option here, so un-check it to save a lot of space on the event page!
    # - 7. And guess what? Inside this conditional branch command, we need to make
    #      another one, yay! This time, we will check for a switch. Remember those
    #      20 (or more) switches needed to be reserved at the beginning? Those are
    #      the switches checked here. For the sake of simplicity I will name the
    #      switch as 'First Question'. The conditional branch should check if this
    #      switch is OFF! Remember, it needs to check if it is turned OFF and not ON,
    #      so make sure to change the default 'ON' check to 'OFF'!
    #      Again, we do not need the 'Set handling if conditions do not apply'
    #      option, so un-check it to save a lot of space on the event page!
    #      This check will be responsible to eliminate the already asked questions
    #      from the question pool.
    # - 8. You will be delighted to hear, that we are done with the conditional
    #      checks for now, yeeehaaaa!
    #      Now, if everything is done right, we are inside of a double conditional
    #      check now (not counting our very first check made!).
    #      All the magic happens here! You can ask the actual question here too.
    #      As a matter of fact, that is the first thing to do here.
    #      For this example, I will use a message box + choice based question.
    #      But do note, there are many different ways of asking a question, some of
    #      them includes using certain scripts, some of them doesn't.
    #      First, make a 'Show Text' command. Enter your question in the text box.
    # - 9. Next, make a 'Show Choices' command. The name of the choices will be
    #      the possible pool of answers the player will see. By default, the maximum
    #      amount of choices shown at once is 4, this can be extended by certain
    #      scripts, however. An empty choice name will not show up in the game!
    #      So, make your answers with the choices, place as many as you want (or can)!
    #      Make sure to select 'Disallow' in the little 'When Cancel' part of the box
    #      at the right side of the 'Show Choices' box. This won't let the player to
    #      exit the question without being answered by pressing the cancel button.
    # -10. When you are done with setting up the possible answers, head over to the
    #      "correct" answer. Below the 'When [correct answer]' part of our
    #      'Show Choices' command make a 'Control Variables' command.
    #      In this command, select the 'Correct Answers' variable and add +1 to it.
    #      So, set the operation to 'Add', and the operand should be set to
    #      'Constant' with the number 1. This will add +1 to the variable but only
    #      if the player selects the correct answer.
    #      This way, at the end of the quiz mini-game we can show the number of
    #      correct answers given to the player if we want.
    #      Note that this step is purely optional only, as it will not affect the
    #      functionality of the quiz system at all.
    #      You can also do any other effects you want here.
    #      For example a sound effect on a correct answer, or a message shown, or
    #      an animation shown, or raising some points with another variable for some
    #      kind of point system, or anything else you want, literally.
    # -11. If you are done with setting up the effects on the correct answer, do the
    #      same with the wrong answers. As for the correct answer, everything you do
    #      here is optional.
    # -12. When you are finished with the wrong answer setup too, move to the end of
    #      our 'Show Choices' command. It is indicated by a black 'Branch End' note.
    #      Pay attention! It is a BLACK 'Branch End' note, not a BLUE one!
    #      Mixing the two up will break the quiz system completely!
    #      Once at the right place, make a 'Control Switches' command.
    #      Now we need to turn ON our 'First Question' switch which we used to check
    #      at the beginning of our first question.
    #      Once this switch is ON, this question can not be asked again until the
    #      player finishes the quiz mini-game and only if the quiz will be reseted
    #      after that! More information on resetting later!
    # -13. Immediately below, make a 'Control Variables' command.
    #      Select the 'Questions Asked' variable and add +1 to it.
    #      So, set the operation to 'Add' and the operand to 'Constant' with the
    #      number 1.
    #      This increments the 'Questions Asked' variable by 1 every time the player
    #      has answered a question, regardless if the player answered the question
    #      correctly or not.
    #      Remember our very first 'Conditional Branch' command? That one checks for
    #      this variable, and if this variable reaches the number defined in that
    #      check, the loop we made at the very beginning of the page, will break,
    #      and no more questions will pop up after!
    # -14. And this is it! We made our first question! Congrats to us, right?
    #      What you should see now below our last command added is exactly 3 BLUE
    #      'Branch End' notes and one 'Repeat Above' note.
    #      The next question should go AFTER the SECOND 'Branch End' note but
    #      BEFORE the THIRD one! If you put it anywhere else, it will break the
    #      quiz system! Yay for caps-locked words!
    # 4. Time to make our 'Ending Phase' for reseting (or not) the quiz event!
    #    Most of the things done here is optional. These are needed if you want the
    #    player to be able to start the quiz mini-game again.
    #    The page should be set to 'Autorun' at the 'Trigger' settings!
    #    If you don't want it to be reset-able, just place a single text or whatever
    #    else you want on this page and after the contents you made, you need to
    #    switch to another page of the event which is not set to 'Autorun', or else
    #    your player will be stuck!
    #    The following series of conditional branches and texts will make a message
    #    box appear at the end of the quiz mini-game to show the player how many
    #    correct answers he/she got. You can make any additional effects here, such
    #    as giving a special item to the player, or a special buff, gold reward,
    #    sound/graphic effects, and so on, and so on, and all of these can be
    #    dependent on the number of correct answers given or points collected through
    #    the quiz mini-game!
    #    I will use the 'Correct Answers' variable for all of the following
    #    'Conditional Branch' commands! None of these conditional checks need the
    #    'Set handling when conditions do not apply' option, so un-check it
    #    everywhere! Let's get started!
    # - 1. First, this whole 'Ending Phase' uses a different page, not the one where
    #      we set up our questions to save some space for that page. If we use a lot
    #      of questions, we need every inch of space there to be saved!
    #      So create another page in our quiz event. Now, we will give this page a
    #      condition, so that it will not trigger before that condition is met.
    #      The condition can be (as mentioned above at the questions setup) either
    #      a self-switch or a switch. As I mentioned way above, I will use a switch
    #      called 'Ending Phase' here.
    #      So, at the left side of the event page, over the 'Conditions' part,
    #      check the first 'Switch' box, and select our 'Ending Phase' switch here.
    # - 2. Now to populate this page with commands...
    #      Immediately at the start, we make our first 'Conditional Branch' command.
    #      It should check for the 'Correct Answers' variable, and it should check
    #      if the variable is 'Less than or Equal to' 3.
    #      This means that the contents inside this conditional check will only
    #      activate if the player got 3 or less correct answers in the quiz.
    # - 3. Insert any effect inside the conditional branch. I choose to show a simple
    #      text which shows how many correct answers the player gave during the quiz.
    #      If you want to show a variable inside a message box, use the '\V[x]'
    #      message code (without the apostrophes!), where 'x' is the ID of the
    #      variable you want to show. You can find the IDs of the variables at the
    #      left of the names of the variables. There is no need to put all those
    #      zeros before the numbers, so instead of '0001', you can just put a simple
    #      '1' there.
    # - 4. After the blue 'Branch End' note, we shall create another conditional
    #      check! We use the same variable as before, but now we will check if
    #      the variable is 'Greater than or Equal to' 4.
    #      Hold your horses here, we are not done with the conditional checks yet!
    # - 5. Inside the previous check, make another one! This one should check if
    #      the variable is 'Less than or Equal to' 6.
    #      With this we are now inside a double conditional check!
    #      Ohh, the memories!
    #      Anything you put here will only happen if the player got
    #      at least 4, 5 or 6 correct answers!
    # - 6. So, put your effects here, just like you did inside the previous check.
    # - 7. Our next check goes after the second blue 'Branch End' note.
    #      We are going to make another double check. The first one should check if
    #      the variable is 'Greater than or Equal to' 7. The second one should check
    #      if the variable is 'Less than or Equal to' 9.
    #      So, the content inside the double check will only show if the player got
    #      7, 8 or 9 correct answers during the quiz.
    # - 8. Make your effects inside the double check!
    # - 9. And the last check should go below the two blue 'Branch End' notes
    #      again! This time we check if the variable is 'Equal to' 10.
    #      Anything inside this check will only happen if the player managed to answer
    #      all the questions asked correctly!
    # -10. Put your effects inside the check!
    # -11. Of course, you can make as many checks like these here as you want.
    #      Just make sure you condition your checks the right way!
    # -11. After the last blue 'Branch End' note, you can put any additional effects
    #      to trigger. Anything you put here will happen regardless how well or bad
    #      the player answered the questions!
    # -12. After our content commands we did above, it is time to make our
    #      functional commands. The following process is the "reset" process.
    #      These commands will make this whole quiz event repeat-able!
    #      This is fully optional, mind you!
    #      Our first step here is to switch OFF any switches we made for the
    #      questions on the question page (switches like 'First Question').
    # -13. The second step is to reset all the variables used in the quiz event.
    #      We do this with simple 'Control Variables' commands.
    #      We will reset the 'Questions Asked', the 'Correct Answers' and the
    #      'Question Randomizer' variables by setting all of them to 0!
    #      Remember, set the operation to 'Set' and the operand to 'Constant' with
    #      the number 0!
    #      Setting the 'Question Randomizer' to 0 is not necessary, I guess, so you
    #      can skip that one, if you wish.
    # -14. And our last thing to do on this page to wrap up the reseting process
    #      is to switch off the used self-switch(es) or switch(es).
    #      We used the switch named 'Ending Phase' to trigger this page, so we need
    #      to switch off that one with a 'Control Switches' command.
    #    With this, we successfully reseted the quiz event, and the player is ready
    #    to take on the challenge again! Yay!

    How to enhance our system:
    # Let's see how could we enhance our quiz system in various ways!
    #  1. The first thing anyone can notice, is that this system uses hell of a lot
    #     switches to function properly if you made a lot of questions.
    #     But there is a solution for this, and comes in a form of a script called
    #     "Bit Switches" made by Tsukihime. Thousand thanks goes to him for making
    #     that scipt!
    #     So how will that script help us?
    #     By using that script, it is possible to exchange all those switches used
    #     for a single variable! If your quiz got 50 questions, that is no less than
    #     50 switches saved! I say, that is a pretty nice save!
    #     In the demo, I have set up some quiz events with these bit switches for
    #     your convenience. Examine them to understand how they work!
    #     But before that, make sure to read the mentioned script's header for some
    #     examples on their usage! It might help with understanding bit switches and
    #     their functions.
    #  2. Another great addition might be the timed questions! Wouldn't that be
    #     awesome? Well, great news to you, it is possible to do that with another
    #     script called "Window Timer" made by no other than Tsukihime... again!
    #     Another thousand thanks goes to him for it!
    #     As always, read the script's header to understand the usage of the script!
    #     You can also look some quiz events in the demo to understand how this
    #     script functions. Read the comments I made inside these events!
    #  3. And how about ditching all of these choice based quiz mini-games and making
    #     a quiz system on a whole new level? Like with real, text input based
    #     answers, for example!
    #     Well, I be damned, this one is too possible! Who could have guessed, right?
    #     We can use yet another script called "Simple Text Input" made by...
    #     yeah, you guessed it right, Tsukihime made that one too!
    #     One second... This makes this how many thanks now? Right, three thousands!
    #     Read the script's header to understand the usage of this script!
    #     You can also look at the example quizes I set up in the demo to see it in
    #     action! Read the comments made in these events!
    #  4. Alright, that text input based answer system rocks, but making the player
    #     to enter all these text with an on screen selectable keyboard is just not
    #     very convenient...
    #     So how about a real keyboard input instead?
    #     What? No way, you say? Yes, there is a way!
    #     By using yet another script called "Keyboard Name Input" made by...
    #     no, no, this one is made by Dekita! Hahh, gotcha!
    #     Thousand thanks goes to him for making this script!
    #     This script is plug-and-play, no extra knowledge is needed for this!
    #     Configure the settings of the script once, and you can forget about it!
    #     This script requires the script named "$D13x - Core" made by Dekita also.
    #     You can take a look at that script too, configure it if you need, but that
    #     script is not used in making this quiz system, it's there only because it
    #     is needed for the "Keyboard Name Input" script.
    #     And even though it is not really used in this demo, I still give another
    #     thousand thanks to Dekita for making it, if not for anything else, than
    #     because I actually use it in my own project in development!
    #  5. Unlockable choices? So... unlockable answers as well?
    #     Hmm... Could be useful! If not for anything else, than maybe for a
    #     difficulty system with unlockable difficulties! Not bad!
    #     The script used to make this is called "ATS: Choice Options" made by
    #     Modern Algebra. Thousand thanks to him for making this script!
    #     It has many other uses and setups, read the script's header to understand
    #     the usage of this script!
    #     There is also one quiz event made with a difficulty system in the demo,
    #     so you should take a look at that one too!
    #  6. Descriptions for choices? Could be used for something too, right?
    #     Like describing a category from the quiz, or describing the differences
    #     between different difficulties. So many "diff"s!
    #     The script used to make this possible is the same as for the unlockable
    #     choices, so another thousand thanks goes to Modern Algebra for making it!
    #     An example of the usage of the script is present in the demo too, so
    #     peek inside that event too!
    #  7. Colored choices? Fancy! Can be used to color different categories or
    #     difficulties or even choice answers!
    #     This will surely make your quiz system a bit more lively!
    #     The script used for this is called "Choice Options" by Tsukihime.
    #     Another thousand thanks to him! Wow, so many thanks! *.*
    #     Consult to the script's header to see the usage instructions, or examine
    #     the event made with this in the demo!
    #  8. More than 4 choices for the answers? Yes, please!
    #     Script used to make this happen is called "ATS: Choice Options" made by
    #     Modern Algebra, so another thousand thanks to him for this feature!
    #     It is not used in the demo for making any quiz systems, but you can see
    #     a choice selection of 5 choices on the starting map.
    #     No special knowledge is needed for using this function, just place
    #     'Show Choices' commands below each other and they will be merged
    #     automatically!
    #  9. Longer choices than the default maximum length (which is 50 characters)?
    #     There could be some use of that too, right?
    #     Two scripts in the demo can do that, either Tsukihime's "Choice Options" or
    #     Modern Algebra's "ATS: Choice Options". Another thousand thanks goes to
    #     them for this feature!
    #     It is not used in the demo, but the possibility is there for you!
    # 10. Got bored by the placement of the choices on the screen?
    #     Well, I certainly am, dunno about you...
    #     With the aid of Modern Algebra's "ATS: Choice Options' script, it is
    #     possible to place your choices anywhere you want on the screen!
    #     Another thousand thanks goes to Modern Algebra for this feature!
    #     You can even make multiple columns for the choices! Super-cool!
    #     Not used in the demo, but the possibility is there for you!
    # 11. Two additional scripts are included in the demo, to make writing message
    #     boxes a bit easier. These script are called "ATS: Text Formatting" and
    #     "ATS: Message Options" made by Modern Algebra. This adds another two
    #     thousand thanks to him!
    #     Read the header of the scripts to understand what each of these scripts do!
    # I guess, I included every little enhancement in this list.
    # But if someone thinks there are some other features which could be added with
    # or without a script, please let me know! Thanks!

    Might be good to know things:

    # This section will contain some useful information to avoid some nasty and
    # annoying issues with our eventing process.
    # 1. That message box, it just disappears! WTFruit?!
    #    Well, yeah, it happens for some unknown reasons, but at least if you read
    #    a bit longer, you can find out why...
    #    Placing any commands in the editor between a
    #    'Show Text' and a 'Show Choices' command will make your message box
    #    disappear in the game as soon as the player press the confirm button at the
    #    end of the message text shown. The moment the player press the confirm
    #    button, the message box disappears and the choice selection window appears.
    #    It happens even if you place a single 'Comment' or a 'Label' command, for
    #    example, so take care where you put these!
    #    You can examine these anomalies in the demo as well, because I made a
    #    comment before the first question's 'Show Choices' command in the editor
    #    at some places.
    #    This can indeed be annoying, but now that you know what causes it, you can
    #    at least avoid it.
    # 2. If you use graphics for these quiz events, then you will need to update
    #    their 'Autonomous Movement' settings, so that they will always face the
    #    player, regardless of how many pages your event has, and regardless from
    #    which side the player activated the event.
    #    Set their 'Speed' to 'x4 Faster' and their 'Freq' to 'Highest'.
    #    For their 'Type' select the 'Custom' option, and click on the now enabled
    #    'Move Route' button.
    #    Here make a single command which will be the 'Turn toward player' command.
    #    Make sure to enable the 'Repeat Action' option too!
    #    This will make the event face toward the player all the time while the quiz
    #    is active.
    #    This setup is good for stationary quiz events. For moving quiz events, you
    #    will need to do this at the beginning of each page with the 'Set Move Route'
    #    event command. In this command box, first change the speed and frequency of
    #    the event with the respective commands shown, and then make the turn toward
    #    player command. Then at the reseting phase, revert back the speed and
    #    frequency of the event to their default values.
    #    You need to do this before the loop command!

    # Credits:
    # Tsukihime for the following scripts used in this demo:
    # - Choice Options
    # - Window Timer
    # - Bit Switches
    # - Text Input
    # (Loop Counts script did not work for some reason! >.>)
    # Modern Algebra for the following scripts used in this demo:
    # - ATS: Formatting
    # - ATS: Message Options
    # - ATS: Choice Options
    # Dekita for the following scripts used in this demo:
    # - $D13x Core
    # - Keyboard Name Input

    Quiz System Demo:

    # Here is a demo with many of the features already set up for you!
    # Read the comments in the events to understand the system!
    # I made a lot of comments, don't let them be a waste of my time, pretty please!
    # Thank you!
    Demo link: https://www.mediafire.com/?hc9vo5b0bk17adg

    A (maybe) helpful screenshot:

    Quiz System Example.PNG

    I hope I explained everything in an understandable way.

    I tried to be newbie friendly with the explanations, but if someone got any questions, requests, or ideas of how to enhance this system even more, I am here, shoot me with them! :D

    Can't say that I can make requests come true for sure, but seeing what other people would want to see is a good way for me to get to know the expectations. :p
    Last edited: Feb 6, 2017
    LyonBuster, ct_bolt and Awl_ii like this.
  2. distantskater

    distantskater Warper Member

    Likes Received:
    First Language:
    Definitely something cool to look forward to.
  3. txtk

    txtk Veteran Veteran

    Likes Received:
    First Language:
    The demo link is dead. Please reupload it, I really need this.
  4. kazukazu

    kazukazu Villager Member

    Likes Received:
    First Language:
    Yes, the demo link is dead. Please re-upload it because I really need it.
  5. Sixth

    Sixth Veteran Veteran

    Likes Received:
    First Language:
    Primarily Uses:
    Ohh my!

    I knew I forgot something!

    No idea if the new demo I uploaded is the finished version or not (this is the only backup I found on my PC), but there is a demo available now. Sorry for the delay!
    txtk likes this.

Share This Page