playMaker

Author Topic: Global Send event  (Read 1820 times)

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Global Send event
« on: April 18, 2018, 05:43:05 PM »
I'm not sure how to set this up so I thought I'd pick the collective brains of the Playmaker forum!

I have, Let's say, 30 GameObjects in a scene and each one has a child called 'Phantom' When the player does something during the game, the Phantoms need to be deactivated. I need a way to send instructions to deactivate the phantoms following an in-game event so I guess 'Send Event' would be the place to start!

I need to send an event (bool toggle) which is picked up by the GameObjects parenting the phantom to tell them (the GameObjects) to deactivate their child.

How would I set this up?
Obviously, I create a global bool which changes when the event happens.

Is it possible to use this to control child objects of other GameObjects?

I have looked at the Send Event action but I don't know how to set it up. What do I put in the FSM of Send Event? Do I set the Bool up here?
Does the first state (Send Event) have a transition to the next state with perhaps 'bool changed' than then runs back to the first state every frame or does the actual event 'bool changed' sit under the 'Send Event' state so there is just a single state?

By the way, the Game Objects are put into the game using 'create object' actions during game play so they are prefabs and so are their children (the phantoms).

thanks for any advice :)

 
« Last Edit: April 18, 2018, 06:08:05 PM by richardh »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Global Send event
« Reply #1 on: April 19, 2018, 04:17:20 AM »
Send event > broadcast all and use the global event name that will be used only in phantoms ("deactivate phantoms").

In each object that hold a phantom put an fsm that will receive the "deactivate phantoms" event and then do whatever it needs to do to its phantom children.
Available for Playmaker work

richardh

  • Junior Playmaker
  • **
  • Posts: 97
Re: Global Send event
« Reply #2 on: April 19, 2018, 05:01:13 AM »
Is the Send Event the Actual global event or do I create an event and then create a send event which references the global event?

So is that three separate FSMs - An FSM (set as a global event)(added to an empty game object) that listens for a global bool toggle. Then another FSM on another empty to send the global event, and then an FSM on the parent of the phantom to tell it to toggle the child phantoms as active/deactivate?

will this work on prefabs?

thanks for help


Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Global Send event
« Reply #3 on: April 19, 2018, 07:51:00 AM »
You need to create an event and mark it a global for fsm's outside sender fsm to receive it (even if they're on the same object).

Use references instead of prefabs (don't drag and drop stuff from project, reference them on runtime).

I'm not clear i follow.

Let's say you have player that picks up a powerup that disables Phantoms. Phantoms are children of PhantomParent.

Player has attached FSM that detects you picked up a powerup and fires a global event with send event action and broadcasts to all.

You have an event manager so you can set up a global event there from any FSM.

PhantomParent receives a global event and goes into desired state which is disable children.
P
Available for Playmaker work