Skip to content

Dialog

This page documents hooks in the dialog category.


GetNPCDialogOptions(client, npc, canCustomize)View Source

Purpose

Allows plugins or modules to add extra dialog options before an NPC conversation menu is displayed.

Category

Dialog

Realm

Client

Parameters

Player client The local player opening the dialog.

Entity npc The NPC entity that opened the dialog, if valid.

boolean canCustomize Whether the dialog session allows customization options.

Returns

table|nil Return a table of extra conversation options to merge into the NPC dialog. Returning nil allows the default behavior to continue.

Example Usage

  hook.Add("GetNPCDialogOptions", "liaExampleGetNPCDialogOptions", function(client, npc, canCustomize)
      return {
          AskForWork = {
              statement = "Any work available?"
          }
      }
  end)

OnDialogNPCTypeSet(client, npc)View Source

Purpose

Runs after a player finishes assigning a dialog NPC type so modules can react to the updated NPC.

Category

Dialog

Realm

Server

Parameters

Player client The player who updated the NPC.

Entity npc The NPC entity whose dialog type was changed.

Example Usage

  hook.Add("OnDialogNPCTypeSet", "liaExampleDialogTypeSet", function(client, npc)
      print(client:Nick(), npc:GetClass())
  end)

OnNPCTypeSet(client, npc, npcID, data)View Source

Purpose

Runs after a server resolves an NPC dialog type and before the sanitized dialog payload is sent to the client.

Category

Dialog

Realm

Server

Parameters

Player client The player opening the NPC dialog.

Entity npc The dialog NPC being opened.

string npcID The unique dialog type identifier assigned to the NPC.

table data The filtered and sanitized dialog data being sent to the client.

Example Usage

  hook.Add("OnNPCTypeSet", "liaExampleOnNPCTypeSet", function(client, npc, npcID, data)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled OnNPCTypeSet for %s", client:Name()))
  end)