From ecba93d4a48891600af503d9ade5fcbef121b64a Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 7 May 2026 10:03:17 -0700 Subject: [PATCH] fix(editor): NPCs default to Wander behavior + UI tooltip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tools/editor/editor_ui.cpp | 7 +++++++ tools/editor/npc_spawner.hpp | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/editor/editor_ui.cpp b/tools/editor/editor_ui.cpp index f8ad5711..e5990bf3 100644 --- a/tools/editor/editor_ui.cpp +++ b/tools/editor/editor_ui.cpp @@ -1961,6 +1961,13 @@ void EditorUI::renderNpcPanel(EditorApp& app) { int bIdx = static_cast(tmpl.behavior); if (ImGui::Combo("Behavior", &bIdx, behaviors, 4)) tmpl.behavior = static_cast(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); diff --git a/tools/editor/npc_spawner.hpp b/tools/editor/npc_spawner.hpp index ca369bc3..47217099 100644 --- a/tools/editor/npc_spawner.hpp +++ b/tools/editor/npc_spawner.hpp @@ -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;