Bark Trigger Merchant Encounter

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
IKiea
Posts: 3
Joined: Tue Feb 28, 2023 3:04 pm

Bark Trigger Merchant Encounter

Post by IKiea »

Hey! New member to the pixel crushers forum, wanting to ask about if a conversation can be triggered by a bark if for example characters were saying barks and one triggered a conversation that has been linked through one specific bark for each of the characters and they stop to let the conversation take over without switching scenes. Would love some insight thanks!
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark Trigger Merchant Encounter

Post by Tony Li »

Hi,

Yes, you could do that. Add a Dialogue System Trigger to the character. Set it to OnUse, and configure it to start a conversation. In your bark, set the Sequence field to something like:
  • Dialogue Text: "Come see my wares!"
  • Sequence: SendMessage(OnUse,,speaker)@{{end}}
That sequence is a bit complex, so I'll break it down:

SendMessage(OnUse,,speaker) sends the message "OnUse" (without any parameters) to the speaker, which in this case is the barker. The Dialogue System Trigger that's set to OnUse will receive this message and start the conversation.

The @{{end}} part delays the SendMessage() command for a duration specified by the special keyword {{end}}, which is a value determined by the text length and the Dialogue Manager GameObject's Display Settings > Subtitle Settings > Subtitle Chars Per Second. For example, if the text is 120 characters and Subtitle Chars Per Second is 30, the value of {{end}} is 120/30 = 4 seconds.
IKiea
Posts: 3
Joined: Tue Feb 28, 2023 3:04 pm

Re: Bark Trigger Merchant Encounter

Post by IKiea »

Would I add the trigger to my merchant that has no component? Or my other characters who would encounter him?
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark Trigger Merchant Encounter

Post by Tony Li »

Add the Dialogue System Trigger to your merchant.

If the merchant is the character that's barking, you can use the sequence I suggested above.

If the merchant is a different character, you'll need to specify that character's name. For example, if the character's GameObject is named "Merchant":
  • Dialogue Text: "Hey, merchant. Come over here and show the player your wares!"
  • Sequence: SendMessage(OnUse,,Merchant)@{{end}}
Post Reply