53. Use dialogue events and quest completion
Scripts and visual scripts can listen for OnDialogueStarted and OnDialogueEnded. Register the event in the script’s event settings, then use the event’s dialogueId to decide which conversation it concerns.
| Event data | Use |
|---|---|
| dialogueId | Identifies the conversation that started or ended. |
| playerId | Identifies the active player at the event. |
| interrupted, on the ended event | Distinguishes deliberate cancellation from a normal completion. |
| Caller context | Can carry additional information from the action or script that started the dialogue. |
A normal dialogue completion also notifies the quest system. An interrupted session does not count as that normal completion. If a quest only needs a particular clue, recording a variable on that branch is more precise than assuming any ending means the clue was heard.
Start with simple logging or a harmless counter when testing an event. After verifying which dialogue and completion route fired it, add the intended game change.
A global event handler can observe several conversations, including nested ones. Filter by ID. Otherwise one side exchange may trigger a reward intended for the main conversation.
Do not restart a dialogue from its own started event, or call the same closing sequence recursively from its ended event. An event is a hook, not an instruction to repeat the event that called it.
