- summary: Ask an NPC on the current map to run one of its actions.
- area: Game.Npc
Ask an NPC on the current map to run one of its actions.
Kind request · Area Game.Npc
WHEN TO SEND IT
Send it when the player picks one of the actions an NPC offers - talk, open its shop, and so on. You need three things, and all three must agree:
the NPC's id the contextual id of the NPC ON THIS MAP, not a data id. It is the id the map sent you for that actor, and it is routinely NEGATIVE. Do not invent it and do not carry it across maps. the action id which of that NPC's actions you want. Small integer. the map id the map you are on RIGHT NOW.
Sending it before the map is loaded, with an NPC that is not on that map, or with an action that NPC does not offer, is refused.
WHAT COMES BACK
Nothing addressed to this request, when it works - the action itself answers.
A dialogue action (talking to the NPC, using a portal NPC) answers with
NpcDialogCreationEvent and then the NPC's first line,
NpcDialogQuestionEvent; opening a shop answers with the shop's messages. On
refusal the server sends a failure event that carries no payload, so it tells
you THAT it failed and never why.
SO DO NOT WAIT ON A REPLY TO THIS MESSAGE. Wait on the action you asked for, and treat the empty failure as your only negative.
WHY THE MAP ID IS IN HERE
It is the server's guard against a stale click: the NPC id alone is ambiguous once you have changed map, and this pins the request to the map the player was actually looking at.
When you may send it
- Requires
context_readyobserved - Requires
character_loadedinferred
Related messages
- You will receive one of
NpcDialogCreationEventobserved — the success of a dialogue action (talking to the NPC, using a portal NPC): the dialog opens and its first line follows; 1 of 1 capture (action 3 on the Incarnam portal NPC). Other actions answer with their own workflow's messages instead - You will receive one of
ExchangeNpcShopStartedEventobserved — the success of a merchant's buy/sell action: the shop opens with its stock; 1 of 1 capture (action 1 on NPC -20000, answered 29 ms later) - You will receive one of
NpcGenericActionFailureEventinferred — the refusal: an empty event, so it tells you THAT the action failed and never why
Fields
| # | Field | Type | Meaning | You set it |
|---|---|---|---|---|
| 1 | npc_action_id | int32 | Which of that NPC's actions to run. Small integer. | required |
| 2 | npc_map_id | int64 | The map the player is on. Guards against a stale click. | required |
| 3 | npc_id | int32 | The NPC's contextual id on the current map. Usually negative. | required |