Skip to content

YaSpeakerComponent

The YaSpeakerComponent allows creators to make non-player characters (NPCs) speakable so that players can talk to NPCs using the preset dialogues. Dialogues are displayed when the NPC is interacted with players. You can only apply this API to a speaker. A speaker is a non-player character (NPC) with a Dialogue component.

Functions

number AddCommonDialog(number dialogID, [number triggerDialogID])

SERVER ONLY 
Adds a dialogue that is open for all players to the speaker. The dialogue is activated by adding it to the speaker. The dialogSN will be returned by default.
  • dialogID The unique identifier of the dialogue.
  • triggerDialogID The triggerDialogID is used to group UI dialogues.

number AddCommonQuestDialog(number dialogID, number questID, [number triggerDialogID])

SERVER ONLY 
Adds an interactable dialogue that is open for all characters to the speaker. The dialogue is activated by adding it to the speaker.
  • dialogID The unique identifier of the dialogue
  • questID A unique identifier for the quest.
  • triggerDialogID The triggerDialogID is used to group UI dialogues.

boolean ContainsCommonDialog(number dialogID, [number dialogSN])

Returns true if the current dialogue is contained in the list of the speaker's generic dialogues. Generic dialogues can be interacted with all players.
  • dialogID The unique identifier of the dialogue
  • dialogSN The serial number of the dialogue

boolean RemoveCommonDialog(number dialogID, number dialogSN)

SERVER ONLY 
Removes the speaker's generic dialogues.
  • dialogID The unique identifier of the dialogue
  • dialogSN The serial number of the dialogue