playMaker

Author Topic: How to stop a transition unless a bool value returns false.  (Read 2057 times)

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
How to stop a transition unless a bool value returns false.
« on: January 23, 2019, 10:39:15 PM »
I have a test bool action on state 1 and I'm trying to get the transition to state 2 to wait for a bool variable to return false. I set the bool test to check for it to return true, and it goes to the next state, I set it to go to the next state if it returns false, and it still goes to the next state. Like it's not even testing the bool.

Athin

  • Full Member
  • ***
  • Posts: 163
Re: How to stop a transition unless a bool value returns false.
« Reply #1 on: January 23, 2019, 10:50:33 PM »
Not exactly sure what you're trying to do from how you explained it but sounds like you got something not set up properly. 

First I'd watch what the bool value is when the action checks it. Make sure something else isn't setting it to something you don't want.

Also make sure that if you want the action to just sit there waiting for that bool to go true to only have an If true event going.  Leave the false event blank otherwise it will fire off right away.

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: How to stop a transition unless a bool value returns false.
« Reply #2 on: January 23, 2019, 11:05:57 PM »
Basically I have a tutorial and when you start the game it asks you if you want to go through the tutorial, if you click no it sets the tutorial bool to false, and deactivates the tutorial. If you click yes it sets the bool tutorial to true and the tutorial starts. I watch the FSM but it always goes unimpeded and deactivates the tutorial.

Athin

  • Full Member
  • ***
  • Posts: 163
Re: How to stop a transition unless a bool value returns false.
« Reply #3 on: January 23, 2019, 11:16:01 PM »
Is the Bool actually getting set to true?  Sounds like either the bool never changes or your checking the bool too soon before it can switch to true.  Have the Bool in question selected as you test it and watch if it does get set to true ever.  If it does then seems to be a timing issue when you check the bool.  Otherwise your problem will be the bool itself not being set to true.

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: How to stop a transition unless a bool value returns false.
« Reply #4 on: January 23, 2019, 11:23:39 PM »
Here are some screenshots:

https://imgur.com/a/SbIQlEp

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: How to stop a transition unless a bool value returns false.
« Reply #5 on: January 23, 2019, 11:29:00 PM »
I watched the bool, when it's in state 1 it looks like it disappears and only appears once it's in state 2.

Athin

  • Full Member
  • ***
  • Posts: 163
Re: How to stop a transition unless a bool value returns false.
« Reply #6 on: January 23, 2019, 11:37:15 PM »
Ok I think I can see the issue you got. 

Tutorial Question FSM is immediately checking the Bool and (I'm guessing) is seeing that it is False right away by default so fires off the event. 

What you need to do it only have it check the bool once a button is pressed.  On both your Yes and No FSM have an "Send Event" action at the end of it to the Tutorial Question FSM.  In the Tutorial FSM have State 1 Listening for that event.  Once it receives that event (Player clicks on yes or no) have it flow to state 2 to check the Bool value.

Hope that helps!

MichaelPatriot21

  • Playmaker Newbie
  • *
  • Posts: 23
Re: How to stop a transition unless a bool value returns false.
« Reply #7 on: January 23, 2019, 11:45:35 PM »
That worked, thank you so much :).

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: How to stop a transition unless a bool value returns false.
« Reply #8 on: January 23, 2019, 11:45:57 PM »
Hi.
as what Athin said, the default of the variable is probably 'false' when the game starts.
You can go to the variable to set the default to true.

But you can make this easier in a single fsm.
just have the 2 ui click (yes/no) in a single state and set a transition for each button (yes and no)

Also you should avoid using global variables :
Playmaker Best Practices