Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to Random question + shooter script ?

Discussion in 'Scripting' started by BlueRose, Jun 3, 2015.

  1. BlueRose

    BlueRose

    Joined:
    May 31, 2015
    Posts:
    4
    i have problem for radoming question for shooter target ^ question = answer
    in game = 1- player get random question from A-B-C-D
    2- if player get random B - in screen will falldown ballon multiple choice D-A-B or other random with B inside
    3-and player must shoot B baloon and + 100 if player shoot other (wrong answer) B will be -100
    or 2- if player get random D - in screen will falldown ballon multiple choice D-C-B or other random with D inside
    or 3- and player must shoot D baloon and + 100 if player shoot other (wrong answer) B will be -100
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    I'm sorry, but it's really hard to figure out what you're asking for help on... perhaps if you show us the code you've got and you can let us know which bits aren't working the way you want we can figure it out.
     
  3. BlueRose

    BlueRose

    Joined:
    May 31, 2015
    Posts:
    4
    core my problem is how to create 3 random (1-2-3) drop balon and which one is aswer same as question (1)
     
  4. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Just gotta quote LeftyRighty in not understanding what you want. Sorry if its because of your grammar, but I do not have a clue what you are talking about, I'm sorry. If you could describe it with whole and short sentences for someone who does not know anything about your project, maybe this would help.
     
    BlueRose likes this.
  5. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    I'm envisaging "who wants to be a millionaire" crossed with an archery competition at the moment...

    if that's close to what you need; I'd have a list/array of wrong answers as a variable on each question so you can create a pool of incorrect answers, store the correct answer as a separate variable.

    When you instantiate the 4 ballons use Random.Range(...) to pick 3 from the incorrect answers and create one with the right answer.

    On each ballon (i.e. put it on the ballon prefab so the instantiated ballons get it too) have a script which has a variable to store the answer it's been given, so that when it is popped you can compare it's answer to the correct answer in the question.