playMaker

Author Topic: Broadcast events in the same frame.  (Read 2501 times)

protozerg

  • Playmaker Newbie
  • *
  • Posts: 7
Broadcast events in the same frame.
« on: June 14, 2016, 03:37:35 AM »
Hi,

I'm using Playmaker 1.7.8.4.

Can I send more than one events in the same frame?

Like the code below, I'd like to send two different events from codes.

According to the debugger, I don't think second one is working properly.

Is there another way to send multiple events from codes?

Code: [Select]
void AFunction()
{
    PlayMakerFSM.BroadcastEvent("GlobalEvent1"); // event sent
    PlayMakerFSM.BroadcastEvent("GlobalEvent2"); // event not sent
}

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Broadcast events in the same frame.
« Reply #1 on: June 14, 2016, 07:34:16 AM »
Hi,
I tested it on 1.8.1 and there it works fine

Make a copy (backup) of your project folder
and update Playmaker to 1.8.1 and try again :)

protozerg

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Broadcast events in the same frame.
« Reply #2 on: June 14, 2016, 02:45:08 PM »
I updated playmaker 1.8.1, but the same problem occurs.

Both "GlobalEvent1" and "GlobalEvent2" are in the same FSM in one game object.

Could it be the problem?

protozerg

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Broadcast events in the same frame.
« Reply #3 on: June 14, 2016, 03:01:50 PM »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Broadcast events in the same frame.
« Reply #4 on: June 14, 2016, 06:48:10 PM »
hi,
Ah, so you want to trigger 2 events in one fsm in the same frame.
That might be an issue indeed can you make some pictures of what you want to do?
maybe you can make a workaround for it.

protozerg

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Broadcast events in the same frame.
« Reply #5 on: June 15, 2016, 02:02:57 PM »
I moved the event which is not triggered to another FSM in another game object

so I think it works fine now.

Do I have to use only one event in one FSM except START?

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Broadcast events in the same frame.
« Reply #6 on: June 15, 2016, 03:02:18 PM »
Do I have to use only one event in one FSM except START?

Hi,

No, I believe your issue was firing two events that are in one state, at the same time.

Basically you can only be in one FSM state at any time- and by sending two events at the same time, you were forcing playmaker to be in 2 different states at the same time, which it can't do.

So you can have as many global events in an FSM as you want, but to fire them, correctly, you need to send each event at a different time/frame. Also bear in mind that the actions in a states that the first global event sends to, also need to finish running before you send a second global event to another bunch of states.

Again, basically just bear in mind the basic principal that; only one state in an FSM can be active at any one time.

Glad you got it all working now!