fix(editor): NPCs default to Wander behavior + UI tooltip

CreatureSpawn::behavior defaulted to Stationary, so newly placed
NPCs would never move at runtime. The "NPCs do not patrol or
wander, they stay put" complaint was a default-value issue, not a
missing feature — switching the default to Wander (radius 10y)
gets normal NPCs roaming out of the box.

Added a tooltip on the Behavior combo making it explicit that this
is the runtime mode (the editor's preview doesn't run movement
logic; the behavior kicks in once the zone ships and the server
consumes the exported SQL). Lists what each mode means:
Stationary / Patrol / Wander / Scripted.

Existing zones with explicitly-set Stationary NPCs are preserved
on load — only fresh defaults are affected.
This commit is contained in:
Kelsi 2026-05-07 10:03:17 -07:00
parent 3a6f119f7a
commit ecba93d4a4
2 changed files with 12 additions and 2 deletions

View file

@ -1961,6 +1961,13 @@ void EditorUI::renderNpcPanel(EditorApp& app) {
int bIdx = static_cast<int>(tmpl.behavior);
if (ImGui::Combo("Behavior", &bIdx, behaviors, 4))
tmpl.behavior = static_cast<CreatureBehavior>(bIdx);
if (ImGui::IsItemHovered())
ImGui::SetTooltip(
"Runtime AI mode (not editor preview).\n"
"Stationary: stay put.\n"
"Patrol: walk waypoints (W to add at cursor on selected NPC).\n"
"Wander: random walk within radius — common default.\n"
"Scripted: handled by server-side script.");
if (tmpl.behavior == CreatureBehavior::Wander)
ImGui::SliderFloat("Wander Dist", &tmpl.wanderRadius, 1.0f, 100.0f);

View file

@ -43,8 +43,11 @@ struct CreatureSpawn {
// Templates can be scaled higher per-NPC if needed.
float scale = 1.0f;
// Behavior
CreatureBehavior behavior = CreatureBehavior::Stationary;
// Behavior. Default is Wander with a small radius so newly-placed
// creatures actually move at runtime — Stationary was the old
// default and was a frequent "my NPCs don't patrol" complaint.
// Editor preview doesn't run AI; this kicks in once the zone ships.
CreatureBehavior behavior = CreatureBehavior::Wander;
float wanderRadius = 10.0f;
float aggroRadius = 20.0f;
float leashRadius = 40.0f;