Command your squad.
Sell the rest.
rde_bodyguards is AI companion management for ox_core — recruit by rarity, give real follow/guard/patrol orders to an active squad, and list anyone you don't need on a public marketplace where payouts reach the seller even while they're offline.
Overview
rde_bodyguards is a full AI-companion system: recruit bodyguards with a rarity roll, level them up, deploy up to three at once, and give squad-wide or individual orders. A public marketplace lets players sell bodyguards they don't want to anyone browsing — not a targeted 1:1 offer, an actual listing board.
Quick Start
ensure ox_core
ensure ox_lib
ensure ox_inventory
ensure ox_target
ensure oxmysql
ensure rde_phone
ensure rde_banking -- marketplace payouts depend on it
ensure rde_bodyguards
F6 Keybind Fallback
The chat command /bg is disabled by default on purpose — F6 is the intended non-phone fallback, chosen specifically to avoid chat spam. Both work independently of whether the phone app is running.
Rarity & Recruitment
Rarity is rolled at recruitment and affects base stats and skill generation. A recruited bodyguard counts against Config.MaxOwned (20 by default) regardless of rarity.
Squad Orders
| Order | Behavior |
|---|---|
| Follow | Stays close, matches player movement. |
| Guard | Holds a position, engages threats nearby. |
| Patrol | Roams a defined radius. |
| Peaceful | Holsters weapons, non-combative. |
| Dismiss | Despawns — returns to roster, still owned, not deleted. |
Mass orders apply to the whole active squad at once — useful mid-fight without opening a menu per bodyguard.
Public Marketplace
Distinct from the older direct-trade system (which still exists, targeting a specific buyer's character ID). The marketplace is a real listing board: list a bodyguard with a price, anyone browsing can buy it, no target buyer required at listing time.
UPDATE ... WHERE status = 'active' — if two players buy the same listing in the same instant, only one succeeds; the other is automatically refunded. No bodyguard is ever sold twice.
A bodyguard must be despawned (not currently active) before it can be listed.
Common Pitfalls
NPWD bridge code was pasted inside another function's body
The old roster-push logic for the NPWD phone bridge wasn't placed alongside the real rde_bg:getAll callback — it was pasted inside it, between the real logic and its closing return. The event handlers it registered (AddEventHandler('ox:playerLoaded', ...) and two RegisterNetEvent calls) only actually registered the first time getAll was called — not at resource start, as intended.
Fix: separated back into a clean, self-contained callback. The lesson generalizes — a function body should never contain another feature's setup code, even if it "happens to run eventually."
Direct-trade payouts silently failed for offline sellers
The original 1:1 trade system paid the seller via an online-only money export — an offline seller simply never received payment, with no error surfaced.
Fix: the new public marketplace pays through rde_banking's AdjustBalanceByCharId, which works regardless of the seller's online status. The old direct-trade system was left as-is rather than retrofitted — the marketplace is the recommended path going forward.
FAQ
Can I list a bodyguard while it's deployed?
No — despawn it first. This matches the existing direct-trade system's rule.
Does the marketplace require rde_banking?
Yes, for payouts specifically. The rest of the squad-management system doesn't depend on it.
What happens to a listing if the seller goes offline?
Nothing — it stays active and purchasable. Only the payout needs the seller to be reachable, and AdjustBalanceByCharId doesn't need them online for that either.
Changelog
Public marketplace added — offline-safe payouts via rde_banking, atomic purchase claim prevents double-selling.
NPWD/Module Federation removed. Nested-function bug in the roster callback found and fixed.