playMaker

Author Topic: Custom System Events  (Read 5454 times)

disturbing

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 7
Custom System Events
« on: April 20, 2011, 12:47:31 AM »
How system events work, they are automatically called in the background to force a transition to a state.

Is it possible to create an event that can be used anywhere and is automatically occurring in the background?

For instance, If I wanted to recreate ON_ENTER_TRIGGER where the gameobject is continuously checking the Unity onEnterTrigger functionality; that event would fire if it exists in the FMS.  What would I have to do to make this happen if the functionality exists?

Best Regards,

~DisTurBinG

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom System Events
« Reply #1 on: April 20, 2011, 02:39:06 AM »
Hi,

Quote
Is it possible to create an event that can be used anywhere

say the event you want to send is "MYEVENT"

you'll need to create an event "MYEVENT" in each fsm you want to catch that event. Then you create a State and add a Global Transition to it and you select "MYEVENT" from the list. that's you wired in that fsm to start acting upon this event.

Then you can either trigger that event to a specific fsm using

https://hutonggames.fogbugz.com/default.asp?W35

or you can broadcast to all fsm in the scene using:

https://hutonggames.fogbugz.com/default.asp?W493


Quote
and is automatically occurring in the background?

The catch is that for a given Fsm, There can be only one active state at a time. So be aware of this, if you don't want to break your process for a given fsm, create a another one that will catch that event and do your background stuff there. As far as responding to event, nothing can occur in the background on a given fsm. that's why if you create two, it effectively gives you the ability to run two fsm process on the same gameobject. That's how you run things in the background with playmaker ( correct me if I am wrong here).

now for your ON_ENTER_TRIGGER continously checking, there is several ways to do that.

 -- Either you use the built event ( COLLISION ENTER or TRIGGER ENTER ) they will occur anytime there is a collision or trigger happening on that GameObject.
 -- use an idle State and add the following action:

https://hutonggames.fogbugz.com/default.asp?W30

or

https://hutonggames.fogbugz.com/default.asp?W37

They both give you more control. And from there you can trigger any of your custom event.

If there is anything blurred or that needs clarificiation, don't hesitate.
 Bye,

 Jean



disturbing

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 7
Re: Custom System Events
« Reply #2 on: April 24, 2011, 08:11:45 PM »
So there is no way for all FSM to have a global event name.  You must create the event in each one that I want to catch the event?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom System Events
« Reply #3 on: April 25, 2011, 01:19:59 AM »
Hi,

 Currently yes. And this goes ugly down the road if you want to refactor such a "global" event, cause you have to go through all your fsm and rename them.

 Alex said he's working on something global, so I'd expect something soon on that regard ( I also miss this very much too ).

 Bye,

 Jean