PlayMaker 'Listen sequencer message' action?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

PlayMaker 'Listen sequencer message' action?

Post by Abelius »

As the title says.

We have a 'Send sequencer message' action... but I'd really like to have some way to listen for those messages from a PlayMaker state.

Would that be possible without resourcing to complicated back and forth logic?

Cheers.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Tony Li »

Only the sequencer receives those messages, so you may need a little back-and-forth logic. For example, if you want a PlayMaker FSM to receive an event "SomeEvent" when the sequencer receives the message "Typed", you can use this sequencer command:

Code: Select all

FSMEvent(SomeEvent)@Message(Typed)
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Abelius »

Hmm... the thing is, I'd like for all this happening outside conversations.

My current use case is that I'm sending sequencer messages from a PlayMaker action 'Start Sequence', calling a shortcut:

Image

I do this to consolidate all of my game's fade in/outs using DS. And this is working, but what I'm lacking is a way to know when the fade has finished.

From a convo it's easy because that shortcut has a ->Message(FadeDone) substring and DS gets notified and my Continue()@Message(FadeDone) runs.

But if I run the above action in a PM state, I don't have a way to "listen" to that message, so I can't benefit from checking every frame before continuing to the next state.

And I say "listen" because my intention is not to intercept and consume the message. I "just" want the action to pay attention to all the messages sent to the proper sequencer.

Now, if I use the back & forth approach, I foresee a couple of issues.

First, I don't know if that works outside a convo. I suppose it should, as the Start Sequence is working already outside convos, but I don't know where I could configure the logic to send the events back.

And second, my intention is to have several of those "listen" actions at the same time, so different FSMs can react. This could be done by sending a global event, yes, but I'd really would like to avoid those... they're tricky to troubleshoot if something goes wrong. And I'd need to create several of those (untidy).

So, I was wondering if it could be some way to replicate the sequencer functionality regarding its listening capabilities, and only that, so I can just trigger an PM event locally.
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Tony Li »

Would it be sufficient for the "Start Sequence" PlayMaker action to optionally listen for a single message that would trigger an event? (Like this:)

playMakerWaitForSequenceMessage.png
playMakerWaitForSequenceMessage.png (16.94 KiB) Viewed 721 times
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Abelius »

Yes, that would do the trick for this case, in which I only need one FSM listening.

To be honest, even if having a non-initiator listener action would be better, I can't think of any present use case that would benefit from that. So yeah, that would be enough.

I'm guessing that if you select an event in "Wait For Message", it'll be as if you've checked an invisible "Every Frame" field, right? (preventing the action from finishing until it listens the message)

BTW, is assigning the Dialogue Manager object as Speaker necessary and/or recommended?
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Tony Li »

Yes, if you set Wait For Message, it would wait for the message.

I recommend against setting the Dialogue Manager as Speaker. As you change scenes, you could end up with a different Dialogue Manager than the one that was put in that scene at design time. You can probably just leave the Speaker field unassigned.
User avatar
Tony Li
Posts: 21981
Joined: Thu Jul 18, 2013 1:27 pm

Re: PlayMaker 'Listen sequencer message' action?

Post by Tony Li »

Hi,

Here's the updated PlayMaker integration:

DS_PlayMakerSupport_2021-10-17.unitypackage

And a DS patch required for the updated PlayMaker integration:

DS_SequencerPatch_2021-10-17.unitypackage
Post Reply