playMaker

Author Topic: Creating a sequence for opening a door  (Read 4748 times)

siddh

  • Playmaker Newbie
  • *
  • Posts: 4
Creating a sequence for opening a door
« on: May 07, 2013, 07:27:17 AM »
Guys,

A newbie here. I am trying to create a door sequence where the user has to click a button to open door1 then door2 and door3. If the user tries to open door2 or door3 first, it should give an error. I have given all the actions to each door and when the user clicks on any door buttons the actions take place for that door. It does work in a sequence. Please help me.

Regards
Sid.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Creating a sequence for opening a door
« Reply #1 on: May 07, 2013, 07:41:11 AM »
I would use Bool All True and setup checks for each door.

When door 1 is opened, it sets Bool1 to True
Door 2 is setup to be in a locked state until Bool1 is true, when it is true then it moves to an unlocked state where you can open it.
Door 3 is setup to be in a locked state until both Bool1 and Bool2 are True, then moves into an unlocked state where you can open it.

You'll want to add All True checks in the unlocked states as well, in case the player closes a door and the bools are no longer true and the door needs to go back to the locked state.

Booleans are very useful for this kind of thing.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

siddh

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Creating a sequence for opening a door
« Reply #2 on: May 07, 2013, 07:56:09 AM »
Hey Lane,

I have just started using Playmaker. Can you please help me in detail.

Sid.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Creating a sequence for opening a door
« Reply #3 on: May 07, 2013, 08:43:50 AM »
Here is a scene that does what you want. It uses global variables so you have to import them BEFORE you open the scene. Make sure you import playmaker and import the variables FIRST.

To do this properly you need lots of booleans.

Each door needs a Locked and State Boolean. You need them because you have to check if the door is locked and also check if the door is open, since that is the lock for the next door. I threw this together in a couple of minutes so maybe its simpler than I think...

Anyway all you have to do is setup the button to flip a bool variable when it is clicked, it flips the door 1 lock.

now door 1 is unlocked, so you can click it and open it.

after opening it, door 2 is now unlocked. clicking door 2 will open it.

after opening door 2, clicking door 3 will test to see if both boolean variables for the open state of door 1 and door 2 are true, meaning they are both open and if so, the door will open.

There are no real "locks", just tests to see if the bools are true or false and if they are false it just tells you "hey, cant open it", and if they're true it goes through the other path, opening the door.

Its just a matter of creating the bools and setting up the checks. This needs more work, since you can close doors intermittently, but I think you'll get the idea from looking at the scene.

Hope it helps.

Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

siddh

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Creating a sequence for opening a door
« Reply #4 on: May 07, 2013, 09:08:52 AM »
lane,

i created a new project and imported playmaker into the project. Then i tried to import your file. It gave me a fatal error type==kMetaAssetType & pathname. find("library/metadata") ! = 0

Am i missing something?

Sid.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Creating a sequence for opening a door
« Reply #5 on: May 07, 2013, 09:19:41 AM »
Not sure why it would do that.

Here's another package export and also the files in a zip.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Creating a sequence for opening a door
« Reply #6 on: May 08, 2013, 01:22:20 AM »
Hi,

 when you get these kind of errors, it's likely cause the project is a unity 4 one, and you try to open it with unity 3x

bye,

 Jean

siddh

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Creating a sequence for opening a door
« Reply #7 on: May 20, 2013, 05:13:21 AM »
Hey Lane,

Thanks for the file. It worked. I was opening the file in 3.5 therefore i got the error. Thanks to Jean for pointing that out.

Regards,
Sid.