playMaker

Author Topic: Activating a game object problem.  (Read 12953 times)

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #30 on: October 31, 2014, 06:39:45 PM »
You don't necessarily have to use global variables.  You can use "get fsm gameobject" or "get FSM bool" to get variables from another FSM.  you just choose the object, the FSM, and then the variable

with "get FSM ___" you can then store variables in your fsm doing the logic

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #31 on: October 31, 2014, 06:56:35 PM »
You can use "get fsm gameobject" or "get FSM bool" to get variables from another FSM.  you just choose the object, the FSM, and then the variable

with "get FSM ___" you can then store variables in your fsm doing the logic

Regardless of how many times I can add those actions to a state? If that's the case, I will try that out for the gate.
« Last Edit: October 31, 2014, 06:58:50 PM by coffeeANDsoda »

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #32 on: October 31, 2014, 07:01:55 PM »
I'm not exactly sure what you're asking, but if we're talking about bools then your logic FSM will have to listen for updates from the other objects, because an FSM that uses "get fsm" only has the most recent data from the last time I went and "got" the variable.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #33 on: October 31, 2014, 07:28:22 PM »
I'm not exactly sure what you're asking,

Simply adding the same action over and over again since you can't add more than one object to a "get FSM bool" action if I'm not mistaken.


kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #34 on: October 31, 2014, 09:34:08 PM »
Yes that works, you could build strings but that's probably overkill for something like this.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #35 on: November 02, 2014, 06:36:36 PM »
Going back on topic to the closed gate FSM, I made three local gameobject variables, and when I play, press on all three buttons, the gate still doesn't destroy itself.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #36 on: November 03, 2014, 04:39:49 PM »
Also, does it matter if the Gate is the trigger or is it required to have another object parented to destroy it?

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #37 on: November 04, 2014, 01:21:02 PM »
As long as you can tell playmaker to destroy an object that exists in the scene, it doesn't matter where the FSM is attached.  Although it's probably less resource intensive to just de-activate it.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #38 on: November 04, 2014, 02:04:04 PM »
As long as you can tell playmaker to destroy an object that exists in the scene, it doesn't matter where the FSM is attached.  Although it's probably less resource intensive to just de-activate it.

De-activate the gate? How would that be done if I just simply use a "Destroy Self" action on the gates FSM?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #39 on: November 04, 2014, 11:56:57 PM »
What else do I need to add to this state in order to make it transition to the last state?

https://db.tt/j72E46z4

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #40 on: November 05, 2014, 06:45:58 AM »
What do you need the button gameobjects for?  I see you're getting the gameobjects and setting them in that FSM, but why?  What are you going to do with those game objects stored in the FSM?

The only reason you'd do that is if you want that FSM to *do something* to that game object.  Like de-activate it, move it, etc.

How are you triggering your buttons?  First you need something that triggers your button is pressed/clicked on/stepped on, whatever.  Either using a raycast trigger or something.  Then however you are triggering that button as "clicked/turned on/set to true", then you would send that variable (like boolean=true) into a logic FSM that checks if all the buttons have been clicked.

From what I can tell you're getting the FSM gameobject but you don't have a plan as to why?

Really all you need is a way to track your button triggers and some way to activate them (and that can be done in probably a lot of ways), check if they're all true, then de-activate or destroy the gate.

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #41 on: November 05, 2014, 07:00:48 AM »
I just realized maybe the answer to your question is way simpler than I thought...  Do you mean how do you get the state to move on?  I assume you already know you can use "finished" transition as the default moving from 1 state to the next once actions are complete...?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #42 on: November 05, 2014, 11:31:55 AM »

What do you need the button gameobjects for?  I see you're getting the gameobjects and setting them in that FSM, but why?  What are you going to do with those game objects stored in the FSM?

The only reason you'd do that is if you want that FSM to *do something* to that game object.  Like de-activate it, move it, etc.


Correct me if I'm wrong, but didn't you tell me earlier that I could add "Get Fsm Game Object" to the gate in order to make all three buttons destroy it without having to add any more actions to all three buttons? Bare in mind button local 1-3 are set up to be "local variables" that are game objects.

kanae

  • Junior Playmaker
  • **
  • Posts: 52
    • View Profile
Re: Activating a game object problem.
« Reply #43 on: November 05, 2014, 11:54:27 AM »
How you have it set up now, you could have the gate destroy the buttons, see?  If you want the buttons to destroy the gate, all you have to do is the reverse.  You could do this so many ways, I would suggest a simple solution but I don't know how you are doing the button trigger logic.

It's better to keep everything in one place, wherever your buttons are doing their logic to open the gate, you should probably have that same FSM get the gate object, then destroy it when your logic determines the gate should be destroyed.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
Re: Activating a game object problem.
« Reply #44 on: November 05, 2014, 12:51:02 PM »
Quick overhead view of the puzzle.



And then the button FSM data.

https://db.tt/w0tvmd9T

https://db.tt/AKJi4n4k

I do plan to remove exit state because the buttons don't need a combination, they only only need to be pressed once.