playMaker

Author Topic: Waiting for FSM completion  (Read 1079 times)

TVISARL

  • Junior Playmaker
  • **
  • Posts: 50
Waiting for FSM completion
« on: March 08, 2020, 05:28:37 AM »
Hi, all!

In my game, FSM 2 should not start before FSM 1 is finished.
How can I arrange that?

Thanks in advance.

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Waiting for FSM completion
« Reply #1 on: March 08, 2020, 08:14:37 AM »
  • have FSM 1 send an event to FSM 2 when it's completed
  • use a boolean "completed" on FSM 1 that starts as false and is set to true when the FSM is completed and have FSM 2 check bool change on every frame
  • have FSM 2 look at FSM 1 with "is in state" action on every frame

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Waiting for FSM completion
« Reply #2 on: March 09, 2020, 04:24:06 AM »
Hi,

 you can also broadcast a global event if you don't want FSM 2 to know about FSM 1. FSM 1 can broadcast an event "STEP X IS DONE" and so you can keep things boxed this way and the step X can be then modified or reworked without affecting other fsm that simply want to know when step x is done.

Bye,

 Jean

TVISARL

  • Junior Playmaker
  • **
  • Posts: 50
Re: Waiting for FSM completion
« Reply #3 on: March 10, 2020, 09:38:34 AM »
Got it. Thanks to you both.