playMaker

Author Topic: How to stop an FSM from receiving Global Events?  (Read 4148 times)

raphafortin

  • Playmaker Newbie
  • *
  • Posts: 4
How to stop an FSM from receiving Global Events?
« on: May 05, 2015, 02:43:37 PM »
Hey,

so I'm working on a game on Steam right now called CO-OP:Decrypted. We are using Playmaker with Photon right now to make an online mode.

My question is:

Is it possible to stop an FSM from receiving any Global events after receiving a first one? We basically have a platform that needs to receive an RPC (Global events) and then needs to loop some states to play an animation an others. The problem is that it still receives the RPC (Global events) everytime and thus it breaks our loop.

Thank you.

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: How to stop an FSM from receiving Global Events?
« Reply #1 on: May 05, 2015, 05:32:53 PM »
Global events will always fire when received.
How about making it non-global and just setting it as a normal transition from the current state?

/Bad
The Force is with you, young Playmaker – but you are not a C# senpai yet.

raphafortin

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How to stop an FSM from receiving Global Events?
« Reply #2 on: May 05, 2015, 06:15:18 PM »
Yeah we started like this but then it was not possible because of Photon and RPC. It would cause lag and sometimes the event wouldn't go through. I'm sure ther eis a way of like deleting a global event in runtime... ?
« Last Edit: May 05, 2015, 09:28:21 PM by raphafortin »

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: How to stop an FSM from receiving Global Events?
« Reply #3 on: May 05, 2015, 07:40:45 PM »
You can delete the whole FSM if that helps.  ;)
The Force is with you, young Playmaker – but you are not a C# senpai yet.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to stop an FSM from receiving Global Events?
« Reply #4 on: May 06, 2015, 02:05:47 AM »
Hi,

 you'll need to implement the logic, with a boolean flag for example.

1: receive the global event,
2: check if the bool is false, proceed AND set the bool to true, else go to an empty state

Bye,

 Jean

raphafortin

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How to stop an FSM from receiving Global Events?
« Reply #5 on: May 06, 2015, 08:29:49 AM »
Hey Jean,

I can't do that as I have some states that loop in my FSM. If I leave the states they animation or any other looping actions that I was doing will stop.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to stop an FSM from receiving Global Events?
« Reply #6 on: May 06, 2015, 10:00:26 AM »
Hi,

 Then, you need to compose this logic into at least two fsm. one that received the global events, checks if it can proceed, and calls this looping fsm only when you want.

So create a specific global event "PROCEED WITH LOOP" or something, and this global event is only called if you really need to, the first fsm will catch other global events, and in turn send this event if indeed the lopp has to start.

Does that make sense?


 Bye,

 Jean

raphafortin

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How to stop an FSM from receiving Global Events?
« Reply #7 on: May 06, 2015, 11:55:21 AM »
Hey,

Yeah that makes sense, I actually did that earlier but then realised that there was like 200 of them that I would need to apply this solution to. (prefabs are broken).

So yeah, I'll figure something out then.

Thanks