playMaker

Author Topic: Listening to state changes in FSM  (Read 1389 times)

yjwong

  • Playmaker Newbie
  • *
  • Posts: 1
Listening to state changes in FSM
« 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

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Listening to state changes in FSM
« Reply #1 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.