Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: mikejkelley on January 26, 2013, 06:48:35 PM

Title: putting an fsm into a holding pattern[SOLVED]
Post by: mikejkelley on January 26, 2013, 06:48:35 PM
I have two fsms. When A runs, I want B to go into a holding pattern. I tried accomplishing this by broadcasting start and stop events from A, but when A broadcasts, everything winds up hanging.

ie, I have a dino that I want to always face the camera unless there's food in the scene. Then I want that to take precedence and I want him to go after the food.

FSM A determines that there's food and has a state "announceTheresFood" w/ a broadcast event all "goToTheresFood". "goToTheresFood" is a global transition in FSM B that leads to a "theresFood" state that has a "FINISHED" transition that points back to itself. The idea is I don't want the face camera component of FSM B running while FSM A is trying to get food. The assumption is that FSM A would continue to execute but it never actually transistions from "announceTheresFood" thru "goToGetAngleToFood."

I know the ans. is prolly obvious and noobish but I'm exhausted. Thnx in advance!
Title: Re: putting an fsm into a holding pattern
Post by: Ticked_Off_Pixel on January 26, 2013, 07:35:35 PM
I didn't quite understand what's the problem, but usually when I get problems with parallel FSM, I solve it by creating a 3rd FSM to manage the other 2.

Basically, you can get an FSM C, with only 2 states, to enable FSM A or FSM B depending on only one condition.

FSM C
If there's food: Enable B, Disable A.
Food's gone: Enable A, Disable B.

FSM A and B: when active, do stuff ans broadcast to C when finished.

Sorry, if this isn't what you needed.
Title: Re: putting an fsm into a holding pattern
Post by: mikejkelley on January 26, 2013, 07:37:19 PM
Cool, it sounds like that will do just the trick! Thanks!  :)

// It worked! I also had to add a "wait" action after the "send event" in order to specify a transition. Otherwise it continued to hang. I'd assumed it would've just rolled on thru but no. Now I need to address why my anims aren't playing... anyways, thanks again!