playMaker

Author Topic: Simple door unlocking system issues. [SOLVED]  (Read 6523 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Simple door unlocking system issues. [SOLVED]
« on: September 14, 2014, 02:58:20 PM »
Here's the problem. I have a issue understanding the tutorial below because not only it's brief, but how would that apply to just picking up two items and going up to a trigger cube that acts as a lock?
« Last Edit: October 17, 2014, 06:54:07 PM by Lane »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #1 on: September 16, 2014, 12:38:40 PM »
Can you elaborate on your question?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #2 on: September 16, 2014, 01:34:50 PM »
Can you elaborate on your question?

I want to create an unlockable door that doesn't require pressing a button in first person and doesn't display text confirming it. So the lock is a object with collision that disappears after it's unlocked.

Therefore the player needs to simply pick up two objects and collide with the lock object that is a trigger.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #3 on: September 16, 2014, 01:43:38 PM »
Just flip a bool to True for each item you pick up and use Bool All True to see if the items have been picked up when he touches the trigger.

Make sense?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #4 on: September 16, 2014, 02:14:10 PM »
Just flip a bool to True for each item you pick up and use Bool All True to see if the items have been picked up when he touches the trigger.

Make sense?

Meaning that the action "Bool flip's" variable is global for both of the pickup items? Plus would that mean Bool All True would go to the door trigger?
« Last Edit: September 16, 2014, 05:05:52 PM by coffeeANDsoda »

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #5 on: September 18, 2014, 04:35:48 PM »
Doesn't work. This is what I have for the fsm's on both the key and the Door Mananger.

The key FSM
First state has a trigger event action
(On TriggerEnter, Send event set up with a event with a gameobject variable)

Second state has the following actions.
#1 Send event with the event target set to self
#2 Get parent use owner with the same gameobject variable
#3 Destroy Object with same variable as previously, with detach children on.(The fsm is attached to a box that is parented with the key and a empty object)
#4 Bool flip with the global being a bool.

And the DoorManager fsm includes the following states..

#1 wait action with a transitional event

and the second state just has a Bool All True with an event flowing back into the first state as well as the same global bool variable stored in Store Result.




Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #6 on: September 18, 2014, 05:09:36 PM »
Err, I don't really understand what you would do it that way for.

When you pick up the items, they must change some bool to True, it makes absolutely no difference where this information is at, just that you can get to it. Easiest way is to just stick it on the player since he's the one entering the trigger.

Now that you're getting a bool true on the player, when he enters the trigger just make the trigger Get Fsm Bool on all of the bools you need and do a Bool All True action to see if they're true or not.

If that happens every time the player enters the trigger then you have a fantastic gate system that can decide if the door should open or not. Very simple.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #7 on: September 18, 2014, 08:02:02 PM »
When you pick up the items, they must change some bool to True, it makes absolutely no difference where this information is at, just that you can get to it. Easiest way is to just stick it on the player since he's the one entering the trigger.

So I need to add a separate fsm for the player in order to add bool actions?

Now that you're getting a bool true on the player, when he enters the trigger just make the trigger Get Fsm Bool on all of the bools you need and do a Bool All True action to see if they're true or not.

Therefore, I add both of those actions in one state?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #8 on: September 19, 2014, 07:38:41 AM »
Add it in your item management FSM, its probably on your player, right? It just needs to be somewhere accessible to the trigger so that when you enter the trigger it goes into a state where it tries to find those bool's, obviously you can instantly store the thing that collided with the trigger (the player) so its convenient to have it on the player.

You could do the check in one state, should work fine. If its happening too fast then split it into two states: one getting the bools and the other comparing them.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #9 on: September 19, 2014, 01:14:11 PM »
Add it in your item management FSM, its probably on your player, right?


No.

It just needs to be somewhere accessible to the trigger so that when you enter the trigger it goes into a state where it tries to find those bool's, obviously you can instantly store the thing that collided with the trigger (the player) so its convenient to have it on the player.

Would I have to create a separate global event first on the player?


You could do the check in one state, should work fine. If its happening too fast then split it into two states: one getting the bools and the other comparing them.

Via int compare?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #10 on: September 19, 2014, 01:20:59 PM »
Would I have to create a separate global event first on the player?

No.

Quote
Via int compare?

What ints?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #11 on: September 19, 2014, 01:32:40 PM »


What ints?

Wouldn't that help though? What I don't understand what action can I use in order to compare those bools. Because I can't find a action that does that.
« Last Edit: September 19, 2014, 01:38:34 PM by coffeeANDsoda »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #12 on: September 19, 2014, 02:17:24 PM »
Now that you're getting a bool true on the player, when he enters the trigger just make the trigger Get Fsm Bool on all of the bools you need and do a Bool All True action to see if they're true or not.

Bool All True.

Meaning the player has both keys, if both aren't true then don't fire any event, the trigger would do nothing. If both are true then open the door.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Simple door unlocking system issues.
« Reply #13 on: September 19, 2014, 03:12:24 PM »
Now that you're getting a bool true on the player, when he enters the trigger just make the trigger Get Fsm Bool on all of the bools you need and do a Bool All True action to see if they're true or not.

Bool All True.

Meaning the player has both keys, if both aren't true then don't fire any event, the trigger would do nothing. If both are true then open the door.

I find this kind of confusing because I'm not sure whether or not it is required to use global variables or not. However, I have these pics for reference.

https://db.tt/eQ1sVJCJ

https://db.tt/gr1ZsQ0h

https://db.tt/5wDSBLW8

https://db.tt/2XDmp7vR

https://db.tt/GLOKcz1R

https://db.tt/LjNiIutz

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: Simple door unlocking system issues.
« Reply #14 on: September 19, 2014, 03:24:13 PM »
Now that you're getting a bool true on the player, when he enters the trigger just make the trigger Get Fsm Bool on all of the bools you need and do a Bool All True action to see if they're true or not.

Bool All True.

Meaning the player has both keys, if both aren't true then don't fire any event, the trigger would do nothing. If both are true then open the door.

I find this kind of confusing because I'm not sure whether or not it is required to use global variables or not. However, I have these pics for reference.

You can do it with or without globals. Your implementation looks different from what I was suggesting. You aren't even specifying any bools to check in the Bool All True action?