playMaker

Author Topic: Send multiple events  (Read 5214 times)

miki3d

  • Playmaker Newbie
  • *
  • Posts: 3
Send multiple events
« on: June 25, 2012, 08:11:02 AM »
Hi all!

I'm just trying to figure out how to send multiple events in the same state, I attach a screen for explain this.



In another fsm I have a button that send the startspawn event to the fsm above.

Then I want to send three events, one that start a sound, one that switch on a light and the third that spawn enemies.

The problem is that with my way only the event on the top of the stack (OpenDoor) works :(

Maybe It's not the right way...any suggestion?

Really thanks :)
« Last Edit: June 25, 2012, 09:01:33 AM by miki3d »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Send multiple events
« Reply #1 on: June 25, 2012, 08:27:34 AM »
Hi,

 Untick the everyframe property of your send event actions. you 99.99% the case never want that

if you do want to maintain a signal, consider building a start and end event so that other fsm know they enter a specific context and wait for the related end event to quit that context.

 Else, simply send an event once, I never send an event on each update, this is not very good practice ( I feel )

 Bye,

 Jean

miki3d

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Send multiple events
« Reply #2 on: June 25, 2012, 09:03:48 AM »
Hi,

 Untick the everyframe property of your send event actions. you 99.99% the case never want that

if you do want to maintain a signal, consider building a start and end event so that other fsm know they enter a specific context and wait for the related end event to quit that context.

 Else, simply send an event once, I never send an event on each update, this is not very good practice ( I feel )

 Bye,

 Jean

Ops! I was wrong, I was doing a test with every frame checked but I really don't want this, I updated the correct screenshot :) sorry

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Send multiple events
« Reply #3 on: June 25, 2012, 03:17:30 PM »
Hi,

 the problem I see is that you don't implement them events in your fsm and you do specify for each of these events "self" as the target, which means that you should have states defining them events as "global transition"

 Where are you implementing "OpenDoor" "soundLight" and "ActivateLight" I guess they are on other Fsm right? so you should change the target to point to the Fsm or gameObject that implement them events.

 Bye,

 Jean

miki3d

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Send multiple events
« Reply #4 on: June 26, 2012, 04:06:40 AM »
Hi,

 the problem I see is that you don't implement them events in your fsm and you do specify for each of these events "self" as the target, which means that you should have states defining them events as "global transition"

 Where are you implementing "OpenDoor" "soundLight" and "ActivateLight" I guess they are on other Fsm right? so you should change the target to point to the Fsm or gameObject that implement them events.

 Bye,

 Jean

I think you're right...now I don't have one fsm for each object but I tried to do everything with one fsm.

I have a node with this fsm and other objects (door, light..) are child of it, then i refer to these objects from the main fsm (each event go to a state where I manage each object, as you can see in the screenshot).

Maybe it's not the right way :)...I'll try to put one fsm in each object and then send events to them from the main fsm as you sad :)

Thanks a lot!!!

Mik

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Send multiple events
« Reply #5 on: June 26, 2012, 05:23:53 AM »
Hi,

 yes, try that.

 the basic underlying assumption is that when you send an event to a target, the target ought to implement that event as a global transition ( it can also be a transition on the current state, but I rarely go down that route as it feels wrong, but that works)

 bye,

 Jean