Skip to main content
Every NPC handler inside a framework section must return an action object. The action object tells the framework what to do and at what priority.

Action types

Actions are created from the container object (quest, mission, etc.):

Event parameters

Some events take additional parameters passed to the C++ startEvent call:

Action modifiers

Modifiers are chained on any action object. Each modifier returns the modified action.
Modifiers can be chained:

Compact handler syntax

When an NPC only needs one handler, you can use shorthand to reduce nesting:
Use the function form when you need conditionals.

Action table shorthand

In places where a container object is not available (like DefaultActions.lua), use the table shorthand format:
The sequence above plays message 11470, waits 1 second, plays message 11471 while facing direction 82, waits 2 seconds, then faces direction 115.

Handler signatures

All handler functions inside a section follow fixed signatures.

NPC handlers

Event finish handlers

onEventFinish is a table indexed by event/cutscene ID:

Zone-in handler

onZoneIn is a list with a single function. Return an event ID to auto-play it, or nil/negative for no event:

Region enter handler

onRegionEnter is indexed by trigger area ID:

DefaultActions.lua example

DefaultActions.lua uses the table shorthand exclusively since no container is in scope:
Default actions have the lowest priority. A quest or mission that targets the same NPC will always take precedence over its default action entry.