playMaker

Author Topic: How can I stop a loop until event is received?  (Read 1725 times)

ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
How can I stop a loop until event is received?
« on: May 25, 2016, 08:44:37 AM »
This might be a really stupid question with a really simple answer but I just can't figure it out. I have an object with two FSM's, when the screen is touched the touch FSM sends a global event to the movement FSM. This then makes the object do various things. Once the object has gone through the entire loop of states on this FSM, I want it to stop once it has returned to the start, at the state which received the touch event. The problem is it just keeps looping, since I am using a finish transition... I can't stop it from looping though, what could I use instead of a finish transition?

I have included a screenshot of the movement FSM.

Sorry if this is hard to understand I can't explain it very well, it's kind of complex.

Thanks. 

ergin

  • Junior Playmaker
  • **
  • Posts: 86
Re: How can I stop a loop until event is received?
« Reply #1 on: May 25, 2016, 10:59:19 PM »
If you connect it into a state with no finished event it should stop

To stop loops I make use of Global Bools / Test Bool, if you place a bool test at the end of loop and set false to bool anywhere along the way, loop should end.

The other way to stop loops is to send Global events from FSMs to FSMs. Just like the way you started first loop with send event. Lets say EVENT_A is started from another FSM, if you send EVENT_B, EVENT_A stops in same FSM.


ShazBang

  • Playmaker Newbie
  • *
  • Posts: 33
Re: How can I stop a loop until event is received?
« Reply #2 on: May 26, 2016, 04:42:58 AM »
 I knew it would be something so simple, can't believe I didn't think of that!

Thanks heaps.