Page 1 of 1

Bark Trigger Merchant Encounter

Posted: Sat Mar 04, 2023 6:38 pm
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!

Re: Bark Trigger Merchant Encounter

Posted: Sat Mar 04, 2023 7:12 pm
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.

Re: Bark Trigger Merchant Encounter

Posted: Sat Mar 04, 2023 8:07 pm
by IKiea
Would I add the trigger to my merchant that has no component? Or my other characters who would encounter him?

Re: Bark Trigger Merchant Encounter

Posted: Sat Mar 04, 2023 8:48 pm
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}}