PlayMaker Help & Tips > PlayMaker Help

[Solved] FSM not proceeding to next state

(1/1)

JennaReanne:
Hello,
I have an FSM that will not progress to the next state (see attached image).  This is reproducible, but only happens in a particular circumstance.  This FSM is on every monster in my game, and handles most of the events that are sent to monster gameobjects.  One of those events is "Destroy Monsters", which is broadcast to everything.  If the FSM receives this event, it just checks to see if the bool "Selected" is true, and if so it sends the "DestroyMe" message to the "Destroy" state (which, you can probably guess, destroys the object).

In most cases this works just fine.  If, however, a monster was the last thing I clicked before this message is sent out, that particular monster ends up with the FSM stuck on the "Check if Active" state.  All of the other monsters are destroyed successfully, but the one that you clicked on gets stuck like this.  As you can see from the screenshot, the bool is true and the message should be sent, but for whatever reason it isn't.  I'm not even sure how to start figuring this out :/  The only thing I can think of is that this monster would be receiving multiple events at roughly the same time (MonsterClickSuccess and DestroyMonsters) - could those be interfering with each other?

Thanks so much!
-Jenna

EDIT: *facepalm* Never mind, I figured it out!  In short, a different state was changing that bool, but it happens after the DestroyMonsters event is sent.  So when the state checks the bool it actually was still false, even though a split second later it gets changed to true.  Lesson of the day: change variables before sending events that rely on those variables!

Navigation

[0] Message Index

Go to full version