MitchMods-SwornProtectors icon

SwornProtectors

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

CHANGELOG

Changelog

v1.1.0

New Features

  • Custom Placement Mode: Click "Custom Placement" in the H menu to enter point-and-click placement. Your cursor becomes free, a green marker shows exactly where protectors will spawn. Left-click to place, right-click to cancel
  • Single Placement: Set count to 1 and place protectors one at a time, clicking wherever you want them. Keep going until you hit the cap or right-click to stop
  • Group Placement: Set count to 2+ and place an entire formation grid at once, centered on your click
  • Hold On Activate: Custom-placed protectors stay where you put them when equipped, instead of running to follow you

Fixes

  • Structure-Aware Spawning: Protectors now spawn on castle floors, platforms, and built structures instead of falling through to terrain below
  • Floor Clip Prevention: Upward raycast check ensures protectors never clip through floors
  • No More Punch-Through: Clicking menu buttons or placing protectors no longer triggers player attacks
  • Surface Detection: All spawn and teleport positions use Physics.Raycast with proper Valheim layer masks instead of terrain-only heightmap

v1.0.0

New Features

  • Ship Boarding: Board any ship with your full squad. Protectors sit in formation on the deck, weapons sheathed, locked in place while sailing. Works with Karve, Longship, and Ashlands viking ship
  • Slaughter Mode: 60-meter aggressive seek-and-destroy radius. Toggle on and protectors sprint after every hostile creature in range
  • Invincible Toggle: Make protectors unkillable for cinematic filming
  • Dismiss All: One button to despawn every protector instantly for a clean reset
  • Menu-Only Commands: Follow, Stay, Defend, Slaughter, and Invincible all controlled from the H panel

Fixes

  • Shield Wall: Now positions protectors in front of the player in 3 rows of 5, all facing the player's direction. Fast response when player turns around
  • Parade Formation: Uses stable positioning (no Perlin drift) so protectors hold clean parade positions without fidgeting
  • Ship Physics: Protectors disable colliders and rigidbody while boarded so they don't sink the ship
  • Water Splash: Suppressed on boarded protectors so they don't get splashed while sitting inside the boat
  • Weapon Sheathing: Weapons stay hidden while on ship (per-frame enforcement)

Removed

  • F9/F10/F11 keybinds removed (replaced by menu buttons to prevent input conflicts)

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