Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: magique on November 05, 2018, 08:54:12 AM

Title: Wait Action Looping Issue (Solved)
Post by: magique on November 05, 2018, 08:54:12 AM
I have a simple FSM with 2 separate Waits in it. I thought that a Wait will not go to the FINISHED transition until the Wait is completed, but in this case the second Wait, which is 3 seconds long not only completes in just 1 second, it causes the state machine to jump back to the 1 second Wait and perform the FSM tasks over again. And it's looping like this infinitely. It never gets to my last state to EnableAI.
 If I remove the first delay then the FSM works, but just not the way I want it to because I need the first 1 second delay to be timed correctly.

[EDIT]
I'm using Unity 5.6.4p3 with the latest Playmaker.
Title: Re: Wait Action Looping Issue
Post by: Fat Pug Studio on November 05, 2018, 10:09:16 AM
Hi, can we see what's in the states? It will be easier to understand where is the problem.
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 10:37:55 AM
Sure. I'm attaching them here.
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 10:38:34 AM
Final action.
Title: Re: Wait Action Looping Issue
Post by: Fat Pug Studio on November 05, 2018, 12:12:41 PM
Great, i'll have a look :)
Title: Re: Wait Action Looping Issue
Post by: Fat Pug Studio on November 05, 2018, 12:16:21 PM
Have you tried setting wait times under variables to see if the problem persists? And also try changing transition names instead of finished. I know it should work with finished everywhere, but give it a go.

Also, check if your finished event isn't marked as global by accident.
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 12:21:52 PM
I tried setting transition names instead of using FINISHED, but that didn't work. Haven't tried variables. What do you mean by FINISHED being marked as Global? I don't see that anywhere.
Title: Re: Wait Action Looping Issue
Post by: Fat Pug Studio on November 05, 2018, 12:47:37 PM
I'm not even sure that FINISHED can he marked as global event since it's built in, but i'm afk now so i can't check.

Tried saving wait times as variables?

Also, since it's a small  fsm, could you recreate it too see if it occurs again? Did you copy/ paste wait states?
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 01:02:59 PM
No, I haven't tried saving wait times as variables. I can't test at the moment, but maybe later. No, I didn't copy and paste the states.
Title: Re: Wait Action Looping Issue
Post by: DanielThomas on November 05, 2018, 03:50:14 PM
Looking at the state it's simple enough, it should wait 3 seconds. It sounds like the FSM is restarted for some reason?

What I would test, to make sure nothing else is restarting the FSM, is to create a new scene and just paste over this FSM and see if it has the same behavior (make sure it's this FSM Only). If it still has the same problem I would disable the actions in the states and only leave the Wait actions and try if that made any difference.
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 03:53:14 PM
When I get back to it I'm going to try to just create it again from scratch. I think something happened to mess it up.

Thanks for all the help.
Title: Re: Wait Action Looping Issue
Post by: magique on November 05, 2018, 09:38:13 PM
I started making this FSM over again and saw the really stupid error that I made. For some crazy reason I have a SpawnSkeleton state in the chain, which basically spawns the skeleton again, which causes the infinite loop. D'oh! I'm kind of embarrassed for making such a crazy blunder and I have no idea why I did it, but there it is.
Title: Re: Wait Action Looping Issue (Solved)
Post by: Fat Pug Studio on November 06, 2018, 02:06:23 AM
Yeah, it's usually something like that :)