Unlocking Exit with code and other puzzle queries

NikNak6696
30 Mar 2020, 13:50

Hi, I'm trying to make my first game in the form of an escape room. I'm hoping to have people unlock exits by typing in a code say 'ROGB' or '7557' but I'm not sure how to make this happen. I'd also like to be able to have my player answer a question a character poses and if they get it right, the character hands them an object. Any help with these would be appreciated!


XanMag
30 Mar 2020, 19:14

This is a copy-paste from my tutorial "game" that I put together:

I had an NPC where I added the verb talk to; speak to under the verb tab. The following was her response:
"Dear, what would you like to talk about?"
1 - this tutorial
2 - Magoo
3 - Minnie
4 - the meaning of life
5 - a date

  1. I added a 'Get input, then' script, followed by a 'Switch' script in the verb talk to; speak to.
  2. In the 'Switch' script, I discovered an absolutely beautiful bit of code... If you type in LCase(result) in the Switch box, it will take whatever the player types in and make it all lowercase!! If you do this, you do not need to worry about (or account for) a player that types in all CAPS or uses correct capitalization. CATS = cats, Cats = cats, CAtS = cats. It's a nice little tool!
  3. Under the 'Switch' box there is a plus sign next to the word 'Cases:' Click on that.
    4a. For option 1 in the menu, I added this as the case "1","one","tutorial","this tutorial","game","the game","the tutorial"
    4b. What this does is it accounts for anything that the player may type in that indicates that they want to talk about the first thing in your homemade menu. I repeated this basic procedure for the next five cases (cases 2 through 5).
  4. When the player types in a response that matches one of your cases, you need to add a script that runs the appropriate response.
  5. Be sure to add a default response. A default response will take care of anything the player types in that does not match one of the cases.

And here was what I put in the default box to handle any input other than what the NPC reasonably didn't understand.
"I don't understand what you mean, Sweetheart. Try talking to me again when you have your head a bit clearer."

If you need more than this, let me know. The get input/switch/case code is a beautiful thing once you figure it out.

Happy gaming!