playMaker

Author Topic: GLOBAL EVENTS  (Read 3020 times)

MeachWare

  • Playmaker Newbie
  • *
  • Posts: 43
GLOBAL EVENTS
« on: February 11, 2014, 09:53:46 AM »
If I set an EVENT (e.g. "ATTACK_TARGET") to GLOBAL and this FSM is on a PREFAB that will have many CLONES in the scene. When I send this EVENT do ALL cloned objects get the event or just the one.

Sorry if this is a "duh" question; I'm really trying to wrap my head around how PM functions and inter-operates and how (and if) it can support my design concept.

Thanks

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: GLOBAL EVENTS
« Reply #1 on: February 11, 2014, 10:30:31 AM »
You need to send it to all instantiates.

Global events and transitions can be used to fire an event at any time, regardless of what the FSM is currently doing. So it doesn't matter if there is a transition line from the current state or not, it will just go to the state with that Global Transition.

Its especially useful in AI where you don't want to wire up every possible state to each other.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

MeachWare

  • Playmaker Newbie
  • *
  • Posts: 43
Re: GLOBAL EVENTS
« Reply #2 on: February 11, 2014, 12:04:22 PM »
Thanks Lane.

In thinking a bit more about one of my examples, I'm headed in this direction:

* Planet System (will TRIGGER when enemy target ENTERS and EXITS) and will keep a list (ArrayMaker) of "Active Targets" (when target leaves area, it will be removed from the list). Also will launch fighters if current number of fighters is less than two times the number of targets (e.g. 3 targets would mean 6 fighters should be launched) [<-I actually got this part working!] When no enemies the ships will patrol.

Now in thinking about this and after watching some PM youtube tutorials (for like 6 times!); it finally struck me that my Planet System should also be the "fighter manager" and dispatch the nearest fighter to an enemy target.

Finally... to the point/question!

Would my Planet System Manager (FSM) use a GLOBAL event to dispatch the fighter to the enemy or since I have to "find" the nearest fighter wouldn't I just grab its FSM and send the target info?

To everyone that has read this far... thanks  :)

Oh and my first youtube PM video is live...
« Last Edit: February 11, 2014, 12:06:59 PM by MeachWare »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GLOBAL EVENTS
« Reply #3 on: February 11, 2014, 12:23:19 PM »
Hi,

 Not if your manager is responsible for launching this fighter. However, it's not unusual that I actually fire a global event to the owner for another fsm to catch it, so my manager can be made of several fsms, and they communicate via global events still.

In all cases, If you know the target game object, send an event to it specifically, it's always better then firing to everyone and having to filter events then on each implementation.

bye,

 Jean

MeachWare

  • Playmaker Newbie
  • *
  • Posts: 43
Re: GLOBAL EVENTS
« Reply #4 on: February 11, 2014, 02:09:20 PM »
...Not if your manager is responsible for launching this fighter. However, it's not unusual that I actually fire a global event to the owner for another fsm to catch it, so my manager can be made of several fsms, and they communicate via global events still.

In all cases, If you know the target game object, send an event to it specifically, it's always better then firing to everyone and having to filter events then on each implementation.

Thank you - I'm off to work on my manager.