playMaker

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

paradiseprime

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Send FSM Event question [SOLVED]
« on: November 10, 2019, 11:27:38 PM »
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, 03:51:21 AM by paradiseprime »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14684
  • Official Playmaker Support
    • View Profile
Re: Send FSM Event question
« Reply #1 on: November 11, 2019, 12: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

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Re: Send FSM Event question
« Reply #2 on: November 11, 2019, 03: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! ;)