playMaker

Author Topic: Enable multiple FSMs, continue when all are done  (Read 2148 times)

thatnzguy

  • Playmaker Newbie
  • *
  • Posts: 43
Enable multiple FSMs, continue when all are done
« on: April 20, 2015, 07:51:07 PM »
I want a management FSM to start two other FSMs, then have the management continue to the next state when they are done.

What is an elegant way of starting some FSMs, and waiting for them all to finish?
(I don't want to use Run FSM and templates here)
Thanks!
Joel

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Enable multiple FSMs, continue when all are done
« Reply #1 on: April 21, 2015, 01:15:31 AM »
i think a bool all true action is a good option here.

so instead that the other events would send an event back when they are done,
let them set a global bool to true for each other fsm.

then us a bool all true action to check if all are true.

greetings,

Dino

thatnzguy

  • Playmaker Newbie
  • *
  • Posts: 43
Re: Enable multiple FSMs, continue when all are done
« Reply #2 on: April 21, 2015, 09:41:35 PM »
Hey, thanks for the response!

The problem with that is each FSM would have to have a unique corresponding bool, which doesn't work if I want to repeat this action, or have an arbitrary number of 'sub'FSMs

redikann

  • Full Member
  • ***
  • Posts: 174
Re: Enable multiple FSMs, continue when all are done
« Reply #3 on: April 22, 2015, 11:34:10 AM »
One way off the top of my head would be to have an empty gameobject(with FSM) in the scene for each unique FSM you want to control by the master FSM. The master could enable the gameobject thus starting the FSM. The unique FSM object could deactivate themselves when the FSM has completed. Then the master could wait until both object are null before it proceeds.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Enable multiple FSMs, continue when all are done
« Reply #4 on: April 23, 2015, 10:52:09 PM »
you can reset the bool @ the start of each fsm maybe?

or when the management FSM Continued?

another way is using int add, so @ the end of each fsm to add 1 to a global int
and in the master do an int compare,
if the int is equal to the required amount, continue and set the int to 0

greetings,

Dino