playMaker

Author Topic: Receiving multiple send events to one state machine [SOLVED]  (Read 1547 times)

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Receiving multiple send events to one state machine [SOLVED]
« on: April 07, 2018, 07:15:44 AM »
I've got a test game where a Player wants to give an ammo object to another box, with the ammo shown changing hands visually.

In the player's FSM, I have a machine that waits for a SendEvent (give ammo), then it creates an ammo box, places it and sets a trigger to wait for the player to bump into the other box it shall give ammo to. When the ammo is given by the player, the ammo in the player's hands then destroys itself.

The problem is, once this flow happens once, it stays stuck at the last state in the machine. When it receives more 'give ammo' send events from other ammo's, it doesn't play again.

Do I need to reset that machine on the player in some way, to get it to receive Send Events again?

Hope that made sense, this stuff is hard to explain. :X
« Last Edit: April 07, 2018, 09:35:24 AM by Pyremind »

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Receiving multiple send events to one state machine
« Reply #1 on: April 07, 2018, 07:40:29 AM »
On further debugging I've found that the first ammo box sends an event, but the subsequent clones don't send any, despite having identical FSMs...

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Receiving multiple send events to one state machine
« Reply #2 on: April 07, 2018, 08:04:22 AM »
So yeah that's it, the ammo box that starts in the scene can find my player to SendEvent to, but any instances made of the ammo box are sending the event to (none).

So weird!

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Receiving multiple send events to one state machine
« Reply #3 on: April 07, 2018, 09:17:57 AM »
Ugh. Now trying to just set parents to make my hot potato game work.

All I'm doing here is having my HoldTarget (on the player) determine and store a variable (heldAmmo) object.

Then from my player's FSM, I'm using GetObjectFSM to take and store that variable from HoldTarget in the Player FSM as a new variable, which I can then use to pass the ammo.

Though the heldAmmo variable is getting read and stored on HoldTarget, my player's FSM can never seem to read the HoldTarget FSM. And it's like, the variable is RIGHT THERE with the information stored,  ready to use!

I should probly go do something else before this drives me crazy today.

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Receiving multiple send events to one state machine
« Reply #4 on: April 07, 2018, 09:35:09 AM »
I needed to set GetFSMObject to check every frame.  :-X