How do I provide an answer from the same array text?

0 favourites
  • 5 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello there!

    I have a question if it is possible. I have created a multiple choice game where the last ; is the correct answer. It is based on reading data from text file into array

    My question is: Is there a way that when someone chooses one of the answers, a different text appears based on what they chose, without creating a different array for the answers? I have made it choose your own adventure with different txt files as game paths so it would confuse me a lot.

    Like for example: Choosing answer 3- Handshake;You give a firm handshake# ... So when the player chooses that, it will write as answer on the same text box: You give a firm handshake.

    Is there a way to code it this way with symbols from within the text somehow? Like the ; which symbolizes the end of the sentence. So if you put for example a symbol like #, from ; to # it would be the "You give a firm handshake." answer.

    Thank you for reading!

  • The answer depends on how you've set up to read the text file at the moment. Let's see how you're reading choices and assigning them to options in the game.

  • Here it is.. It was from a multiple choice with 1 correct answer template. I removed the random mechanic and made it to just go to the next question normally, so ignore the random name. Also added a NEXT button between stages to show player stat changes if the answer was good or not. So I think after the player chooses and before they press NEXT, it would be great to show the reaction of that action.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks like the text boxes are already displaying the text? You said template so you didn't make this? That will be the problem. tokenat reads text from one string based on dividers which can be a symbol. You don't create a different array, any other text to display would be in the next row and based on the answer chosen you keep choosing that same position in the next string.

  • I see.. I will try to make one more position for each answer then and use it as a reaction, thank you!

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