Repository navigation
Mercenaries
A complete, feature-packed mercenary hiring framework for ServUO. This system allows players to hire high-tier NPC mercenaries directly from their bank balance. Mercenaries possess unique death-prevention mechanics, active tactical kiting, passive health/mana/stamina regeneration, and automatic ammunition collection.
Mercenaries are a modification of hireables normally found at Jhelom Duelling Pits on both facets. Four of the standard hirables have been enhanced and given features. Enhanced versions are labelled as Legendary on their tooltip title.
- Bank Draft Hiring: Hire NPCs via context menu or speech keywords (hire) using gold directly from the player's bank account.
- Death Override & Healer Recovery: Mercenaries never drop corpses, lose gear, or turn into ghosts upon taking fatal damage. They temporarily leave the map to recovery, automatically returning to their master fully healed after a 60-second cooldown (may need to increase cooldown longer for balance - 2 to 5 minutes).
- Passive Regeneration: Ticking passive stat recovery replenishes Hits, Stamina, and Mana every 2 seconds.
- Smart Ranged Kiting: Ranged and spellcasting mercenaries dynamically step back from melee attackers to maintain distance (players may prefer to avoid moving around during combat).
- Auto-Ammo Collection: Ranged mercenaries actively scan the ground and collect nearby arrows or bolts into their backpack (pointless feature?).
- Dynamic AI Switching: Equipping or unequipping ranged weapons automatically toggles between AI_Archer and AI_Melee routines (pointless feature?).
- Bonded on Hire: Bonding allows players to recall with the Mercenary, transferred to another player, shrunk if custom shrinking is available on the server, or traded if shrunk.
Mercenaries consume 4 Control Slots and cost 1,000,000 Gold (withdrawn directly from the bank upon hiring).
When a mercenary reaches 0 HP:
- The death event is canceled (OnBeforeDeath returns false).
- Combat state and status effects (poisons) are cleared.
- The mercenary plays a visual/audio effect and moves to Map.Internal.
- After 60 seconds, the mercenary teleports back to the owner's exact location at full health.
- Server Restart Safe: Recovery timers are serialized via _recoveryStartedUtc and recalculate remaining time upon deserialization.
- Regeneration: Restores +20 HP, Stamina, and Mana every 2.0 seconds.
- Kiting: Checks surrounding targets every 0.5 seconds; if an attacker comes within 2 tiles, the mercenary backs away.
- Ammo Pickup: Automatically collects Arrow and Bolt items within 2 tiles into the backpack every 5 seconds.
| Class | Title | Primary Skills (120 GM) | Default Equipment / Notes |
|---|---|---|---|
| BaseHire | N/A (Base Class) | N/A | Core logic, serialization, recovery timers, and automations. |
| HireFighter | Legendary Swordsman | Swords, Tactics, Parry, Bushido, Chivalry, Anatomy | Random swords/axes, shield, chain/ring/leather armor, Book of Chivalry. |
| HireMage | Legendary Mage | Magery, EvalInt, Meditation, MagicResist, Wrestling, Inscribe | Full Spellbook, Robe, Wizard's Hat. Uses AI_Mage. |
| HirePaladin | Legendary Paladin | Swords, Tactics, Parry, Chivalry, Anatomy | Full Plate Armor, Viking Sword, Metal Kite Shield, 20k Tithing. |
| HireRangerArcher | Legendary Archer | Archery, Tactics, Anatomy, MagicResist, Chivalry | Bow, Quiver, Leather/Studded Armor. Uses AI_Archer. |
-
Copy the code files into your ModernUO custom scripts directory (e.g., Scripts/Mobiles/Custom/Mercenaries/).
-
Compile the server solution.
-
Spawn any mercenary in-game using the [add command:
-
[add HireFighter
-
[add HireMage
-
[add HirePaladin
-
[add HireRangerArcher
-
-
Say "hire" near them for the hire cost. Right-click the NPC and select Hire with sufficient funds to hire the Mercenary.