# Riddle

#### gearbox15

##### Villager
Hello, I could use some help basically I'm make a puzzle where an NPC ask question six riddles if they get at least three they will be allowed to pass. the issue is that I don't know how to make the game know if the player got enough riddles right or not. I think it might involve variables and increasing them but I don't know how to do that.

#### Wavelength

##### MSD Strong
Right. Have a variable called "Riddles Correct", and a variable called "Riddles Answered". When the player answers a riddle correctly, increase both of them by 1 (use "Control Variables" event command to do this). When the players answers incorrectly, increase only the Answered variable by 1.

When the Riddles Correct variable is at least 3, the NPC lets you pass (you can use a "Conditional Branch" event command to check whether Riddles Correct is >= 3).

If the Riddles Answered is 6 and the Riddles Correct is less than 3 (put one Conditional Branch inside the other), you know that they player failed. The NPC might say "You didn't get enough right, I won't move!" If you want to give the player another chance to answer all 6 riddles again, you can set both variables back to 0 ("Control Variables": Set equal to 0) and then ask the riddles again.

#### gearbox15

##### Villager
Right. Have a variable called "Riddles Correct", and a variable called "Riddles Answered". When the player answers a riddle correctly, increase both of them by 1 (use "Control Variables" event command to do this). When the players answers incorrectly, increase only the Answered variable by 1.

When the Riddles Correct variable is at least 3, the NPC lets you pass (you can use a "Conditional Branch" event command to check whether Riddles Correct is >= 3).

If the Riddles Answered is 6 and the Riddles Correct is less than 3 (put one Conditional Branch inside the other), you know that they player failed. The NPC might say "You didn't get enough right, I won't move!" If you want to give the player another chance to answer all 6 riddles again, you can set both variables back to 0 ("Control Variables": Set equal to 0) and then ask the riddles again.

It worked thank you!

### Latest Profile Posts

Friendly reminder: Make a back up of your project! ;3 I just did one and recognized I would have lost a week worth of work.
Why is there undo but not a redo like every other software in existence?
Chili: Evolved to taste spicy so no animal would eat them.

Humans: "Jokes on you ..."
I guess it becomes purely academic in less than four days but before then can anyone explain to me why the %^&*( animations in the MZ database don't have a 'Hue' slider??
Who here knows of the hidden laws of this multiverse? Such as the law of attraction

Threads
113,710
Messages
1,076,832
Members
147,732
Latest member
JackyBoemu