playMaker

Author Topic: Send FSM Event question [SOLVED]  (Read 1133 times)

paradiseprime

  • Full Member
  • ***
  • Posts: 105
Send FSM Event question [SOLVED]
« on: November 11, 2019, 01:27:38 AM »
I am trying to send an event to another FSM. The issue I am having is that I dont want the event to be every frame since that would mess up the receiving FSM but if I dont have every frame on then it doesnt always register even when I put it at the top of the state.

TLDR: Is there a way for me to have a send fsm event be every frame but only send once?
« Last Edit: November 11, 2019, 05:51:21 AM by paradiseprime »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Send FSM Event question
« Reply #1 on: November 11, 2019, 02:41:30 AM »
Hi,

if it doesn't always register, that's odd and it's likely due to a race condition, you can't rely on order of execution between fsms, so you have to put some "next frame event" temporisation, it helps. when an Fsm knows it expects some work to be done at the very same time and it depends on the outcome, then a next frame event will help making sure of the sequence.

as for send event, in order for you to know you need to send this event, you need to reach a logical point in your logic+data, why not then transition to another state, send that event, reset some values or flag and come back to the state?

What is it that you do in this state where you need to send a event at some point and not as the state starts?

you can most likely use some logical action that runs everyframe and can send an event right?

you can also use SetEventTarget to define where event will be sent, and I think it might be the key for you.

Bye,

 Jean


paradiseprime

  • Full Member
  • ***
  • Posts: 105
Re: Send FSM Event question
« Reply #2 on: November 11, 2019, 05:51:07 AM »
Hi,

if it doesn't always register, that's odd and it's likely due to a race condition, you can't rely on order of execution between fsms, so you have to put some "next frame event" temporisation, it helps. when an Fsm knows it expects some work to be done at the very same time and it depends on the outcome, then a next frame event will help making sure of the sequence.

as for send event, in order for you to know you need to send this event, you need to reach a logical point in your logic+data, why not then transition to another state, send that event, reset some values or flag and come back to the state?

What is it that you do in this state where you need to send a event at some point and not as the state starts?

you can most likely use some logical action that runs everyframe and can send an event right?

you can also use SetEventTarget to define where event will be sent, and I think it might be the key for you.

Bye,

 Jean

I actually was able to figure it out. I had the action that didnt have every frame turned on at the top thinking all the actions underneath it would still go first because they had every frame on. It seems this was not the case as once I switched it around and put the action with every frame off at the bottom it all synced up correctly.

But thanks for the assistance! ;)