Skip to content
NP Editor Docs
This is not the latest version — view the latest

Logic graph

The logic graph is an editor that shows World logic rules as nodes and wires, like Unreal Blueprints. It is not a new format: it is the same data as the World logic panel, so an edit on either side is reflected on the other immediately. Each rule is one row connected from left to right: event (red) → conditions (green) → actions (blue · a color per category).

New in 0.10.2: Where nodes overlap, the node drawn on top receives clicks, pins and drags, and a node moves only after you drag it more than 5 px. Dropping a wire on an empty spot opens a search window that shows only the nodes that can connect to that pin. Five flow nodes (Gate · Return · Do Once · Flip Flop · Switch), the math functions inverse_lerp · wrap · snap, node search and alignment were added. Logic that contains the new flow nodes needs NPBridge 2.0.8 or later on the server (see “Reference” below).

The screenshots on this page were taken in the sample world castle.npworld with the “Left area”, “Top right area” and “Bottom right area” checks in the Window menu turned off, and the ⚙ (details) and minimap buttons on the graph toolbar turned off to widen the graph. The first hands-on exercise is in Tutorial: your first script.

Create a rule: alternate “Door open” and “Door closed” every second

Section titled “Create a rule: alternate “Door open” and “Door closed” every second”

Click Tools > Logic graph to open the Logic graph tab in the bottom dock area.

  1. Right-click an empty spot in the graph. The Add node window opens. At the top is a search box; below it are the grouped list (Event · Zones, Event · Actor …) and a preview area.

    The Add node window opened by right-clicking an empty spot

  2. Type timer in the search box and click Timer (global). An event picked on an empty spot becomes a new rule.

    Timer typed in the search box

  3. Type 1 in the Interval (s) field of the event node.

    The interval field of the timer event node

    Known issue in 0.10.2: new rules get untranslated Korean names — “타이머(전역)” for this timer rule, “함수” (“function”) for the function rules in step 5 and “시작할 때 (씬 시작)” for the On start rule in step 10 — and the frame of a rule without actions shows “(할 일 없음)” (“no actions”).

  4. Drag the white exec pin on the right of the event node and drop it on an empty spot. The “Connects after this” window shows only the nodes that can come after it (no events). Type flip flop and click Flip Flop. The node appears where you dropped the wire and connects to the event.

    Picking Flip Flop from the list opened by dropping the exec pin on an empty spot

  5. Drag the yellow pin A (1st · 3rd · 5th) of the Flip Flop node and drop it on an empty spot. A new Function rule (func_1) is created, and field A is set to that function. Connect the B (2nd · 4th · 6th) pin to func_2 the same way.

    Two function rules created by dropping the yellow pins A and B on empty spots

  6. Drop the white exec pin of each function event on an empty spot to add a Chat message, and type Door open (func_1) and Door closed (func_2) in its Text field. Check passed appears on the right of the toolbar.

    The Chat message nodes of the two functions and Check passed

  7. Click the ▶ (Play) button on the toolbar. “Door open” and “Door closed” alternate in the chat every second. Press Esc to stop.

    Door open and Door closed alternating in the chat in Play

  1. When you drag a node on top of another, the node drawn on top receives clicks, pins and drags in the overlapping area. Click the lower node to select it and bring it to the front. This order is kept when the graph is redrawn.

    Overlapping nodes with the selected node brought to the front

  1. Drag the exec input pin on the left of a condition or action node and drop it on an empty spot. The “Connects before this node” window shows only the nodes that can come before it. Type do once and click Do Once: it appears where you dropped the wire and connects directly before the Flip Flop node (one Ctrl+Z undoes it).

    The Connects before this node list opened by dropping the exec input pin

  1. From the exec pin of the “On start (scene start)” rule, add Do Once → Gate (pass condition) → Switch → Return (stop here) in order. Put an expression ({time} > 1) in the If passed field and the value to compare in the Values field of the Switch node. Click + in Cases to add one more case (if equal n · → function to call) and one more yellow pin.

    The Do Once, Gate, Switch and Return nodes

  1. Click the magnifier button (Find node) on the toolbar and type closed in the search box. It searches the nodes of the current graph by name, type, field value and rule name. Click an entry to select that node and move it to the center of the view.

    The Chat message found by the field value closed in the Find node window

  1. Select two or more nodes (drag a box from an empty spot), click the align button on the toolbar, then click Align top. The tops of the selected nodes line up (one undo step).

    The align menu and the two selected nodes

  • If you drag a node less than 5 px (times the UI scale) and release it, it counts as a click. The node stays where it is and nothing is saved.
  • While dragging a node, press Esc to return it to where it started (nothing is saved). After you release it, one Ctrl+Z moves it back.
  • With snap to grid on (the magnet button on the toolbar, on by default), the node you hold snaps to a 16-unit grid. Moving one node does not move the others.
  • When you drop a value pin (circle) on an empty spot, Store in variable (Set variable) is at the top, followed by nodes that take the same type and nodes that take it with a conversion. The node you pick is inserted directly after that pin’s node, with the value wired in.
  • Dropping a yellow function pin on an empty spot creates a new Function rule and connects it right away (step 5).
  • Entries picked in the Find node window are not added to “Recently used” in the Add node window.
  • In 0.10.2, Ctrl+F opens Find node only while you are typing in a text field inside a node. When only the graph is focused, the world shortcut F (Frame camera) takes it first, so use the magnifier button on the toolbar.
  • Turn a rule off and on with the eye button in the header of its event node. A rule that is off is dimmed and does not run.
  • Value nodes (Text operation · Math …) added by right-click or from an exec pin have an empty Result variable, which causes a check error. If you add them by dropping a value pin on an empty spot, the result variable (t1 · m1 …) is filled in automatically.
NodeHeader colorMeaning
EventRedStart of a rule. Its header has the name and the enable (eye) button
ConditionGreenContinues when true (“If true” on the right)
ActionBlue · a color per categoryWhat the rule does
Actor referencePurpleOne scene actor — wire it to an actor field
Not connectedGrayA node not attached to a rule (not saved)
PinShapeConnects
Exec pinWhite pentagonExecution order (event → conditions → actions)
Function pinYellow diamondAn action that calls a function (Call function · Flip Flop · Switch …) → a “Function” rule. One function per pin
Value pinCircle, colored by typeNode results · event data → fields

Lists that open when you drop a pin on an empty spot

Section titled “Lists that open when you drop a pin on an empty spot”
Dropped pinListWhen you pick
Exec output pin“Connects after this” — the conditions and actions that can come after it (no conditions after an action)Created where you dropped and connected after that node. The following nodes are not pushed aside
Exec input pin“Connects before this node” — the nodes that can come before it. For an unconnected node, a new eventInserted directly before that node
Value output pinNodes that can take that valueInserted directly after it, with the value wire connected
Value input pin (field)This rule’s values · nodes that output a value · variablesInserted directly before it and connected
Actor reference pinNodes that take that actor (type)Added to the end of that rule’s chain, with the actor field filled in
Yellow function pin(no list)Creates a new function rule and connects it
NodetypeAction
Gate (pass condition)gateIf the expression is true, goes on to the next action; if false, skips the remaining actions of this rule (function). It is a condition placed between actions.
Return (stop here)stopSkips the remaining actions of this rule (function). Inside a function, goes on to the caller’s next action.
Do Oncedo_onceGoes on to the next action only the first time. Per = everyone together (shared) · each player (each). If Reopen after (s) > 0, it opens once more after that many seconds.
Flip Flopflip_flopCalls functions A and B alternately each time it is reached (first = A).
SwitchswitchCalls the function of the first case equal to Values. Cases 1–8, Else if none match. Numbers are compared as numbers (1 = 1.0).
Math function (Math node · expression fields)ExampleResult
inverse_lerp(a, b, x) — where x lies between a and b (0–1)inverse_lerp(0, 10, 5)0.5
wrap(x, low, high) — wraps around to the other end when out of rangewrap(370, 0, 360)10
snap(x, step) — the nearest multiple of the stepsnap(7, 5)5

Logic that contains the new flow nodes (gate · stop · do_once · flip_flop · switch) or the new math functions needs the server plugin NPBridge 2.0.8 or later. An older server skips nodes it does not know, so actions that should be blocked may still run.

  • Live connection and server deployment: if the server is older than 2.0.8 or does not report its version, the logic is not uploaded and a notice such as “The server’s NPBridge … does not know the new nodes (…), so the logic was not uploaded — …” appears — Server connection (live).
  • Export to file: it is not blocked, but the warning “scene: this logic needs NPBridge 2.0.8 or later on the server (…)” is logged, and the rule’s JSON gets min_bridge (minimum version) and stop_unknown (the actions at which a server that does not know them stops) — Export and import.
  • The server plugin in the installer is 2.0.8 — Installing NPBridge (server admins).
Button · fieldAction
World logic list · + · ⚙Pick the logic to edit (world logic · actor logic) · new actor logic · show the details area
NodeAdd node window (same as right-clicking an empty spot)
Code buttonOpens the current logic as C#-style code (same as double-clicking a node)
Grid buttonAuto layout — clears the saved node positions and lays out one row per rule
Magnifier buttonFind node
Align buttonAlign left · Align top · Align vertical centers · Distribute horizontally (3 or more) · Distribute vertically (3 or more)
Breakpoint buttonBreakpoint (F9) on the selected action node — stops before that action during Play
Frame allFits all nodes in view
Sync with list · Rule frames · Actor nodesSync the selected rule with the World logic list · a comment frame per rule · an actor reference node per actor field (all on by default)
Magnet · minimap buttons · zoomSnap to grid (16) · minimap · current zoom (25%–200%)
Check passed · “Errors n · warnings n”Check result of the current logic
ShortcutAction
Right-click (empty spot)Add node window
DeleteDelete the selected nodes (event = the whole rule)
Ctrl+DDuplicate the selected nodes
Ctrl+C · Ctrl+VCopy · paste nodes
F9Toggle breakpoint (graph focused)
Ctrl+FFind node (while typing in a node’s text field — see Tips and tricks)
Esc (while dragging a node)Back to where it started
Ctrl+drag (node)Invert grid snap while dragging
Ctrl+wheel · wheelZoom in · out · pan the graph
Ctrl+ZUndo (all graph edits)