Why is my quiz not changing question more than once?

0 favourites
  • 10 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I'm creating a multi-answer quiz game and after selecting the answer, I've set the game to call function 'SetQuestions' to show the next question. But for some reason it changes the question only once, so it's only showing a maximum of two questions. Any ideas why it won't change to questions 3,4,5 and so on?

    I've attached an image of the function, is there anything that needs to be changed?

  • There's no loop

  • I've created a for loop as a sub-event when the function 'SetQuestions' is called. I've also included a local variable and added 1 to this after the question is set but it's still not changing the question.

    Is there a particular value I need to set the local variable to?

    The text is currently set to: tokenat(QuestionsArrayShuffled.At(loopindex),0,";") - is this something I also need to change?

  • The loopindex should put inside the loop.

    If you put like this there is no loop for the loopindex can be identified.

  • Not sure what you were trying to achieve here, if you have a loop that runs the function until the end then it would only show the question and answers from the last entry of the loop. Maybe you should be using a variable instead of loopindex to grab all the data for the first set of questions? Then the next question you would add 1 to the variable to get the next row.

  • Thanks guys but I'm a complete novice at this so not getting anywhere, please could you be more specific?

    When you say to put the loopindex inside the loop, how exactly do I do this?

    If I were to use a variable, would this need to be local or global? And also, how would this be done?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • As I recall I made that file so send the new one and tell me what you need it to do, when the questions change etc

  • Thanks so much Lionz.

    I've copied a link below to give you the layout and event sheet:


    Let me know if you have any issues accessing it.

    I think I'm going wrong somewhere in my 'SetQuestions' function but I'm not 100% sure. It's finding the loopindex as I said earlier but you rightly guessed, it's only retrieving the end of the loop so the question won't change. I need the question to change when after an answer has been selected or if the countdown = 0. Hope this makes sense to you.

    Sounds very simple to do but for some reason I just can't seem to get my head around it.

    Thanks again for your help.

  • Delete the loop and replace all loopindex with questionnumber variable.

  • It's worked! Thanks Lionz - you're the best! :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)