Skip to content

Sample: event_example

A sample that adds three NPC talk and quest types to world logic · id event_example · SDK ^1.2 · latest version 1.0.0

Its name in the manager window is 씬 이벤트 예제 (NPC 대화 · 퀘스트) (scene event sample: NPC talk · quest). It shows all three roles of AddSceneEvent (trigger · condition · action), both with and without Simulate.

What it showstype
A trigger without Simulate (fired only with the Fire button)npc_talk
A condition with Simulate (decided from state the plugin remembers)quest_state
An action with Simulate (logs + changes state)quest_start
Actor · Text · Enum · Bool fieldsFields of the three types
Summary templatesAll three types
ItemValue
Editor0.9.0 or later
SDK1.2 or later (^1.2)
Plugin dependenciesNone
Game serverThe NP Scene server plugin + handlers for the same types (see “Server-side behavior” below)
Sourcesamples/plugins/event_example/ in the NP Editor source (Plugin.cs · EventExample.csproj · plugin.json)
  1. Build it.
    dotnet build samples/plugins/event_example/EventExample.csproj -c Release
    If you build outside the source tree, change the csproj to reference NP.Editor.Sdk.dll in the install folder, as in Quick start.
  2. Copy EventExample.dll and plugin.json to %APPDATA%\NPEditor\plugins\event_example\. Do not include NP.Editor.Sdk.dll.
  3. In Tools › Plugin Manager…, click Rescan.
  4. You are done when the Registered column shows scene events 3.

Create a rule that “starts quest q1 the first time the player talks to an NPC”, then test it in Play.

  1. Place one display, text or spawn scene actor. This is the NPC.
  2. Open Tools › World logic and add a rule.
  3. Trigger: group 퀘스트(예제) (quest, sample) › NPC 에게 말 걸 때 (when talking to an NPC). In the NPC field, choose the actor from step 1.
  4. Condition: 퀘스트 상태 (quest state). Quest id = q1, Status = none.
  5. Action: 퀘스트 시작 (start quest). Quest id = q1.
  6. The rule’s one-line summary appears as 플레이어가 NPC 「」 에게 말을 걸면.
  7. Start Play with Play test in the World logic panel, then click Fire on that rule.
  8. [event_example] 퀘스트 q1 시작 → <player> is recorded in the World logic panel’s log list.
  9. Click Fire once more. The state is now active, so the condition is false and the action does not run.

The same rule appears as three nodes in the Logic graph. You can connect the NPC actor’s data pin to the NPC field.

KindNameDescription
World logic triggernpc_talk NPC 에게 말 걸 때When a player starts talking to an NPC. Fired by the server plugin. In the preview it fires only with the Fire button. Icon interact
World logic conditionquest_state 퀘스트 상태True when the triggering player’s quest is in that state. Icon logic
World logic actionquest_start 퀘스트 시작Sets the triggering player’s quest to active. Icon star
EventWorldChangedClears the preview quest state.

All three types are in the menu group 퀘스트(예제).

One-line summary: 플레이어가 NPC {npc} 에게 말을 걸면

FieldTypeRequiredDefaultDescription
npcActor (display · text · spawn)Yes—The NPC actor being talked to
lineTextNo—Dialogue line id. If empty, any line

One-line summary: 퀘스트 {quest} 가 {state} 일 때

FieldTypeRequiredDefaultDescription
questTextYes—Quest id
stateEnum (none · active · done)NononeState

One-line summary: 퀘스트 {quest} 시작

FieldTypeRequiredDefaultDescription
questTextYes—Quest id
notifyBoolNotrueShow a notification

It is saved in scene.json like this (part of a rule).

{
"trigger": { "type": "npc_talk", "npc": "npc_guard" },
"conditions": [ { "type": "quest_state", "quest": "q1", "state": "none" } ],
"actions": [ { "type": "quest_start", "quest": "q1" } ]
}

This sample covers only the editor side. To run the rules on the game server, register handlers for the same three types in the NP Scene server plugin.

typeWhat the server handler does
npc_talkFires rules whose npc (and line) match on an NPC talk event
quest_stateReads the triggering player’s state from the quest store and compares it
quest_startSets the quest to active, and shows a notification if notify
  • Register the handlers with the SceneEventsApi obtained from Bukkit’s ServicesManager in a Paper plugin.
  • A server without handlers skips these types with a single warning. npc_talk rules do not run.
  • The preview quest state exists only in editor memory. It is cleared on new world · open · plugin disable, and is not shared with the server.
  • The notify field of quest_start is not used in the preview (it only logs).
  • The line field is not used in the preview.
  • The type names have no plugin prefix (npc_talk …). They are kept short because this is a sample. In your own plugin, prefix them with your name, as in myquest_npc_talk. If another plugin registers the same type first, this sample does not enable.
  • When the plugin is disabled, rules that use these types get an Unknown type warning. The rules and field values are not deleted.
VersionDateDetails
1.0.02026-10-04First version (SDK 1.2): trigger npc_talk · condition quest_state · action quest_start