Playmaker SendEvent clarification

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Gazoid
Posts: 2
Joined: Fri Nov 04, 2016 9:54 am

Playmaker SendEvent clarification

Post by Gazoid »

Hi there,

Wondering if you can help. I have a conversation being started by playmaker action (all working great) and I'm trying to SendEvent to the currently active NPC.

In the documentation it says:

Code: Select all

In your Sequence, call FSMEvent(eventName, gameObject, fsmName). This will send an event named eventName to an FSM named fsmName on a specific gameObject.
If you leave out fsmName, it will send the event to all FSMs on the gameObject.
If you leave out gameObject, it will send the event to the speaker.
So I want to send an event to the current NPC at the end of the conversation, I can send one perfectly if I specify the NPC gameObject directly with:

Code: Select all

FSMEvent(goto_B, NPC_Human_A, Interact)
There are only 2 FSMs on NPC_Human_A, so

Code: Select all

FSMEvent(goto_B, NPC_Human_A)
works fine

BUT if I do

Code: Select all

FSMEvent(goto_B)
Nothing happens, I made sure that when the conversation is triggered I have specified the NPC as the conversant in the playmaker action (so it's used as the speaker).

The reason I want this to work without directly targetting the NPC gameObject is so I can use the same conversation on on a different NPC, and that the sendEvent works on them, rather than always NPC_Human_A.


Any ideas on what I may have missed? Many thanks for your time :)

Gaz
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Playmaker SendEvent clarification

Post by Tony Li »

Hi Gaz,

Try temporarily setting the Dialogue Manager's Debug Level to Info. When the FSMEvent() sequencer command runs, it should log something like this to the Console window:

Code: Select all

Dialogue System: FSMEvent(goto_B, NPC_Human_A)
Make sure the second argument is the correct GameObject. If not, open the Dialogue Editor window and inspect that dialogue entry node. Check the Actor assigned to the node. It should match the Conversant assigned to the conversation.

BTW, you can use these three special keywords, too:
  • speaker: The speaker of the dialogue entry node.
  • listener: The other primary participant in the conversation.
  • all: Sends the event to all FSMs in the scene.
For example:

Code: Select all

FSMEvent(goto_B, listener)
to target the other primary participant.

If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Gazoid
Posts: 2
Joined: Fri Nov 04, 2016 9:54 am

Re: Playmaker SendEvent clarification

Post by Gazoid »

Aha! Perfect thank you ever so much!

I wasn't aware of listener, works great now thank you.

My issue was that it was the Player ending the conversation tree so without the gameObject specified it was targeting the player, as he was the speaker :)

Fantastic help, great product! :D
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: Playmaker SendEvent clarification

Post by Tony Li »

Thanks!
Post Reply