Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: yjwong on November 15, 2017, 07:30:28 PM

Title: Listening to state changes in FSM
Post by: yjwong on November 15, 2017, 07:30:28 PM
Hi there,

Currently new to Playmaker, is there a way to listen to state changes in a particular FSM? I'm working on a project that works with API.ai (it's a service that processes natural language). Ideally, I would be able to synchronize/send the state name to API.ai whenever state changes happen.

Right now, it's possible for me to use actions, but I'd have to add them to every state.

Cheers
Title: Re: Listening to state changes in FSM
Post by: djaydino on November 16, 2017, 02:18:27 AM
Hi,
make an fsm somewhere and then use 'Get Fsm State' and point it to the fsm component or Gameobject/fsm name ,store the result and check Every Frame.

In the same state have the action 'String Changed' place the result variable and set a changed event.

In the next state you can send the state name and transition back to the 1st state.