Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: thierry_st_malo on August 24, 2015, 01:05:57 PM

Title: Global transitions
Post by: thierry_st_malo on August 24, 2015, 01:05:57 PM
Hi, all!

Sorry for such a basic question, but where can I find a simple example or tutorial showing how to create and use a global transition between two FSMs?

Thanks in advance,

Thierry
Title: Re: Global transitions
Post by: djaydino on August 24, 2015, 03:03:14 PM
Hi, it works very simple :

make a event variable then mark it if you want it to be able to trigger from a different fsm

then you can right click on a state and then go to global transition and select your event variable.
the variable will now be shown above your state.

now you can use a send event to it and that will trigger that event no mater what state is active @ runtime

i will try to make a quick tutorial if i have time tomorrow
Title: Re: Global transitions
Post by: thierry_st_malo on August 25, 2015, 04:18:44 AM
Got it ! Thanks, Dino !
Title: Re: Global transitions
Post by: Grendal on September 08, 2015, 08:22:10 AM
The problem for most people when it comes to global transitions I believe is in the wording of the action "Send Event".
I think many people, like myself, first begin using it thinking it is actually sending an event and begin working from the sending FSM... however, its actually a "Sent TO Event" and sends a call to an event in the targeted FSM.
Title: Re: Global transitions
Post by: djaydino on September 09, 2015, 01:22:02 AM
Hi.
that is indeed possible.
When i started using PM i thought it should be "trigger event"

The problem for now is that we can not change the names from the action,
else when people update it will break their actions.

At the moment there are more and more custom actions adding with that same problem, so there definitively need to be found a solution for it in the future.
Title: Re: Global transitions
Post by: Alex Chouls on September 09, 2015, 03:43:08 PM
Interesting, I hadn't considered this as a point of confusion... I think it depends on the mental model and language you use.

In PlayMaker a state listens for events. Transitions to other state are triggered by events. Events are "sent" either by Unity (MonoBehaviour Events for mouse, physics etc.) or by actions. So Send Event seemed like the logical thing to call it.

I wonder if the concept of Events and Transitions are getting confused?

Events are not unique to an FSM, they are shared across the project. They are basically just a name.
Transitions are unique to an FSM, they define a link to a specific state.
A transition is triggered by an event.
So you send an event to trigger a transition.

Since transitions are not named, maybe you're thinking of the event as the transition...?

I tried to make this clear in the Core Concepts page:
https://hutonggames.fogbugz.com/default.asp?W133

But maybe that's not so easy to find...? Or not clear? :(