Noob question: Need multiple items to unlock door

For help with creating games using Quest

Moderators: Pertex, Alex, sgreig, Cryophile

Noob question: Need multiple items to unlock door

Postby abcdefghq11 » Thu Aug 02, 2012 9:54 pm

I'm making a detective game where in one part you have to collect multiple items. How do I do this?
Scott :mrgreen:
p.s A sample would be preferable
abcdefghq11
 
Posts: 2
Joined: Thu Aug 02, 2012 9:49 pm

Re: Noob question: Need multiple items to unlock door

Postby Pertex » Fri Aug 03, 2012 5:52 am

What does "multiple objects" mean?
User avatar
Pertex
 
Posts: 1102
Joined: Fri Jul 09, 2010 9:52 am
Location: germany

Re: Noob question: Need multiple items to unlock door

Postby sgreig » Fri Aug 03, 2012 11:31 am

Yeah, you're going to have to be more specific as to what you mean, because Quest already has the ability for the player to pick up multiple items.
sgreig
 
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada

Re: Noob question: Need multiple items to unlock door

Postby abcdefghq11 » Sat Aug 04, 2012 5:36 am

sorry i messed up. I mean how do I pick up multiple items to unlock an exit?
abcdefghq11
 
Posts: 2
Joined: Thu Aug 02, 2012 9:49 pm

Re: Noob question: Need multiple items to unlock door

Postby sgreig » Sat Aug 04, 2012 5:56 am

So if I understand correctly, you want to have a locked exit that required the player to have several objects to open? There's two ways I can think of to do it. Both methods involve using nested IF statements.

1. Have the game check if each of the objects is present in the player's inventory. This is probably the most straightforward way.

2. Have the game set a flag, such as "player.hasobjectX" each time one of the required items is picked up, then use the nested IF statements to check if all of the flags are true.

The code would in both cases would look similar to this:


Code: Select all
if (check for condition) {
   if (check for second condition) {
      if (check for third condition) {
         [code to unlock the exit]
      }
   }
}


That's obviously not the proper syntax, but hopefully you get the idea.
sgreig
 
Posts: 391
Joined: Wed Feb 15, 2012 10:16 pm
Location: Winnipeg, MB, Canada


Return to Quest Forum

Who is online

Users browsing this forum: No registered users and 5 guests