MitchMods-SwornProtectors icon

SwornProtectors

Summon up to 15 NPC bodyguards who follow you in cinematic formations. Built for Valheim filmmaking.

CHANGELOG

Changelog

v0.5.0 — Initial Release

Core Systems

  • NPC companion spawning (1-15 protectors) using cloned Player prefab with fresh Humanoid + BaseAI
  • State machine: Awaiting, Following, MovingTo, Attacking, Holding
  • Summoning ritual: protectors spawn kneeling in parade grid, activate on equipment application
  • NavMesh pathfinding with direct-movement fallback for stuck paths
  • Smart teleport when protectors fall 40+ meters behind
  • Cloth physics reset on teleport to prevent cape warping

Formations

  • 6 formation types: Diamond, Line, Wedge, Shield Wall, Circle, Parade
  • Diamond scales from 1-15 with ring-based slot placement
  • Parade auto-holds protectors at attention on arrival
  • Instant reposition on formation switch

Movement & AI

  • Walk-default following with distance-based run catch-up
  • Perlin noise drift for organic, human-like movement
  • Per-protector reaction delay (point man fast, flankers relaxed)
  • Settle hysteresis to prevent idle fidgeting
  • Player avoidance steering (protectors go around you, not through you)
  • Hard repulsion zone to prevent clipping into player model
  • Swimming support with direct movement (no NavMesh in water)

Equipment

  • Full equipment system: Head, Chest, Legs, Cape, Weapon, Offhand
  • Runtime ObjectDB scan — supports all items including modded gear
  • Cape color variants (Linen Cape: 10 colors, Lox Cape: 3 variants)
  • Save/Load/Delete up to 3 outfit presets
  • Default loadout: Flametal armor, red Linen Cape, Splitnir, Flametal Shield
  • Equipment browse mode with scrollable item lists

Weapon Display

  • Weapon draw/sheathe synced with player's R key
  • Per-frame VisEquipment sync to display back-mounted weapons
  • ZDO-based fallback for equipment visual state
  • Explicit back-item/hand-item push via reflection

Combat

  • Auto-defend toggle (12m scan range)
  • Max weapon proficiency (GetSkillFactor = 1.0)
  • Friendly fire prevention (Harmony patches on IsEnemy + Damage)
  • Attack command via crosshair targeting

Voice Barks

  • 100 random spawn barks (medieval humor, groveling, confused)
  • 100 random equip barks (hyped, loyal, over-the-top)
  • Speech bubbles above protector heads via Valheim's NPC text system
  • Staggered random delays so barks feel natural

GUI

  • Dark warrior aesthetic panel with golden glow border and blood-rope trim
  • Formation selector (2 rows of buttons)
  • Equipment browser with per-slot dropdown
  • Outfit save/load/delete rows
  • Cinematic keybinds: F9 (Attack/Move), F10 (Follow), F11 (Hold)
  • Minimap pins for all protectors (P1, P2, P3...)

Technical

  • BepInEx plugin framework (net462)
  • Harmony patches for game integration
  • Reflection-based access to protected Humanoid/VisEquipment members
  • Prefab registered with ZNetScene for networking
  • Non-persistent ZDOs (protectors are ephemeral, despawn on logout)
  • Try-catch wrapped UpdateAI to prevent silent AI death