• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help me with a QUIZ trigger please!

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2008
Messages
279
Im trying to do a quiz trigger, but i cant do it!I do that

Display to all players for 30 secs the text: Quiz[random number between 1-20]
Then i do the variable quiz array, write all strings.Ok, until this part is ok
Now is the reward, how i do to the player who write the right answer receive the gold?Help me please
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Questions[] = an arrayed string variable
Answers[] = an arrayed string variable.

In the initialization trigger, write down your questions and answers:

Questions[0] = "What's the capital of France"
Answers[0] = "paris" <-- write all in lower caps
etc.

  • Events
    • Every 30 seconds of game time
  • Actions
    • Set Question = random integer between 0 and 20 <-- question is integer variable
    • Game - display to (all players) the string Questions[Question]
    • Trigger - turn on "Answer"
  • Answer
  • Events
    • Player 1 enters a chat string containing "- " as a substring
    • Player 2 enters a chat string containing "- " as a substring
  • Conditions
    • Entered chat string from 1 to 2 = "- "
    • Entered chat string from 3 to (length of entered chat string) converted to lower case is equal to Answers[Question]
  • Actions
    • Add 100 gold
    • Trigger - turn off this trigger
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
No.

Maybe I was a little bit unclear. I have following variables:

Questions: string array
Answers : string array
Question : integer <-- note that it's called "Question", not "Questions".

Every 30 seconds you set Question = random integer between 0 and 20.
Now you know that the question is:
Questions[Question]
The corresponding answer is:
Answers[Question].

So when you're asking the question, you display the message:
Questions[Question]

When a player is answering the question, you check if the answer is equal to
Answers[Question]
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Sigh... It does work, but perhaps you made a mistake somewhere. Could you post me your triggers so I can check them on mistakes?

Oh and also go to File > Preferences > Test Map
make sure the "Use fixed random seed" box is UNchecked. Otherwise you'll always get the same order of answers when you're testing the map.
 
Level 8
Joined
Aug 4, 2008
Messages
279
Variables-Questions String array
-Answers String array
-Question integer
  • Quiz Settings
  • Events - Map INitialization
  • Conditions -
  • none
  • Actions -
  • set questions[1] = whats your name?
  • etc until 10
  • set answers[1] = dimitri
  • etc until 10
  • Quiz Asking
  • Events -
  • Every 60 secs of game time
  • Conditions -
  • none
  • Actions -
  • set Question = random integer number between 1 and 10
  • Game display to all players for 30 secs the text: Questions[Question]
  • Trigger: Run Answer checking conditions
  • Events -
  • Player red type - as a substring.
  • Conditions -
  • Entered Chat String Equal to Answers[Question]
  • Actions -
  • Player - add 10 gold to player red
  • turn off this trigger
 
Level 3
Joined
May 3, 2004
Messages
46
First error:
In the "Quiz Asking" trigger, change the "Trigger: Run Answer checking conditions" to "Trigger: Turn on Answer"

Second error:
Currently you have the condition "Entered Chat String Equal Answers[Question]" while the event is "Player red type '-' as a substring", this means that when a player types an answer, for instance -paris, it checks the "-paris" string with the Answers[] array, so if the Answers[Question] has the value "paris", it will return false, as "paris" != "-paris".

Try using substrings, unless all answers start with an -.
 
Level 8
Joined
Aug 4, 2008
Messages
279
yes, the player have to type - as a substring, im going to test it, soon i edit

-----------------------------------EDIT---------------------------------
Thank you, worked but all the questions are always in the same order, its always Question[4], then Question[10], then Question[3], always the same order, i tested 4 times.
-----------------------------------EDIT---------------------------------
omg!!!! worked, thank to everyone helped me!!!
 
Last edited:
Status
Not open for further replies.
Top