This script enables smart NPC movement in Counter-Strike 2 using a dynamic navmesh. NPCs (spawned from a point_template) use a navmesh generated at runtime—seeded from an info_target named npc_walkable—to pathfind to player pings.
- Ramp Preference: NPCs prefer ramps and smooth inclines, but can climb ledges if no ramp is available.
- Edge & Drop Avoidance: Pathfinding cost increases near map edges and drop-offs, so NPCs avoid dangerous areas.
- Seeded Navmesh: Only areas connected to the
npc_walkableseed are walkable. - Debug & Control: Use chat commands:
generate_navmesh— Build navmeshnavmesh_debug— Visualize navmesh for 10 secondsreset— Reset NPC and navmesh
- Configurable: All movement and navmesh parameters are easily adjustable in the script.
Place a point_template with a prop_dynamic named npc and an info_target named npc_walkable in your map to get started.