Routing NPCs

"The patrol was flawless for six laps. On the seventh he walked into the fountain and stayed there." — Second Unit Director Kaine Orlo

A route is a numbered list of waypoints an NPC walks between. You record it by standing where each waypoint should be.

You need an admin rank that carries the NPC permission. That is the only gate. A waypoint records wherever you are, so record them on foot: spectating stores the free camera's position instead.


What it does

StoryForce holds 10 routes, each with up to 10 waypoints. Routes belong to the map rather than to an NPC, so more than one NPC can walk the same one. Each waypoint records your position and the direction you were looking, and can carry a pause, an emote, a spoken line and a despawn.

Routes are session only. A map change wipes all 10 of them.


Recording a route

Waypoints must be created in order. You can edit any waypoint that already exists, and you can add the next one, but you cannot skip ahead.

  1. Stand where you want the first waypoint and face the direction the NPC should face.
  2. Run /npc route 1 1 to record it.
  3. Walk to the second position, face the right way, and run /npc route 1 2.
  4. Repeat until the path is complete, up to 10 waypoints.
  5. Put an NPC on the route with /npc edit 4 route 1.

The yaw is always recorded, because it comes from where you were looking. Add yaw none to drop it, so the NPC keeps facing whatever direction it arrived from.

Try to add waypoint 3 before waypoint 2 exists and StoryForce tells you which number it wants next:


Waypoint options

Everything after the waypoint number is optional. The options can go in any order:

  • dwell <ms> holds the NPC at the waypoint for that many milliseconds before it walks on
  • emote <name> plays an emote on arrival, using the names from the emote list
  • say <text> speaks a line on arrival, in the NPC's own name
  • yaw <deg|none> sets the direction it faces while it waits, or none to leave it unset
  • exit plays the emote's exit animation when the dwell ends, rather than carrying the pose on
  • remove despawns the NPC when it arrives, or when the dwell ends if the waypoint has one

Quote a say line that runs to more than one word, or only the first word is stored.

A say line goes nowhere if the NPC has no display name. Nothing warns you. See dialogue.

Mistype an option and StoryForce stops reading there and tells you. Everything before the bad word is kept, everything after it is dropped:

An option with nothing after it stops the same way, with ^8+++^7 Route option '^3dwell^7' has no value - stopped here^8.^7.


Choosing how the route runs

The mode decides what happens at the last waypoint:

  • loop is the default, and walks the waypoints in order then returns to the first
  • pingpong walks to the last waypoint then retraces the same path backwards
  • once walks the waypoints a single time and holds at the last one

Checking and clearing a route

With no arguments, /npc route prints every route that has waypoints, the options on each waypoint, and which NPCs are walking it. /npc route <id> show prints one route.

An NPC that gave up trying to reach its next waypoint is listed as stalled. Editing any waypoint on the route wakes it up and it tries again.

clear empties the route and takes every NPC off it.

To take one NPC off a route and leave the route alone, use /npc edit 4 route none.


Things to note

  • Re-setting a waypoint wipes all of its options. /npc route 1 2 on an existing waypoint 2 clears its dwell, emote, say, yaw, exit and remove, and records only your position and facing. Repeat every option you want to keep in the same command.
  • Waypoints must be sequential. You cannot create waypoint 5 while the route has 3, because the gap would leave the NPC walking to the world origin.
  • A route needs at least 2 waypoints before an NPC can be assigned to it. With one waypoint, the assignment is refused.
  • A typo drops every option after it. Parsing stops at the word it does not recognise, so dwel 3000 emote salute loses the emote as well as the dwell. The warning names the word, and re-running the waypoint has already cleared whatever it had before.
  • Waypoints record where you are standing, not your crosshair. Stand on the spot, and stay out of the free camera while you do it, because nothing stops a waypoint being recorded mid-air.
  • Routes are wiped by a map change, and are not saved with the map. Save them in a scene file instead. See running a scene.
  • A remove waypoint with a dwell despawns after the dwell, not on arrival, so the NPC gets its pause and its emote first.
  • Waypoint say lines are silent on a nameless NPC, exactly like /npc say.

Next

  • Dialogue: the display name a say waypoint needs, plus speech and ambient chatter
  • Running a scene: save your routes in a scene file so a map change cannot take them