playMaker

Author Topic: RunFSM Question  (Read 2133 times)

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
RunFSM Question
« on: September 18, 2015, 07:38:33 PM »
I need RunFSM to be able to tie in to more events than just a Finished event. I am integrating PM with behavior designer and am using modular PM actions inside my behavior tree, so I need my template to be able to return Success or Failure back to the main PM action. Is there a way to do this?  Thanks.

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Re: RunFSM Question
« Reply #1 on: September 18, 2015, 11:55:03 PM »
The best solution I could come up with was to create a variable "ReturnValue" in my parent FSM(the non-template FSM), and in the TEMPLATE FSM, I set the bool of the Parent FSM. The only problem with this design is you need to know the name of the FSM you are accessing.

I tried to use "Set Fsm Bool" using the TEMPLATE name "IsPlayerWithin_Template" for the Fsm Name, but at runtime it would give an error saying it could not find it. I am assuming local variables don't work with templates? Or there is just a problem setting them at runtime.

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Re: RunFSM Question
« Reply #2 on: September 19, 2015, 03:02:13 AM »
The best design I came up with was to just use "Send Event" using the "Host FSM" as a target. I created 2 global events, BD_Fail and BD_Success, which are used in the hos FSM that calls "Run FSM". This allows me to detect success or failure in the sub fsm.

thatnzguy

  • Playmaker Newbie
  • *
  • Posts: 43
Re: RunFSM Question
« Reply #3 on: September 20, 2015, 04:59:16 PM »
There is a Get Host Info action in the Ecosystem addon, with this you can get the gameobject of the Host.

You still have to set up the host to receive the event or information properly, which is fragile.

I've made a request for a proper output section of Run FSM here