# mack-swimloot
https://medal.tv/games/red-dead-2/clips/mJiQzxJtXuJeap1NU?invite=cr-MSxqZWssMTkxMDIwMzU5
**Underwater Diving & Loot Chest System for RedM — RSG-Core**
A fully featured underwater diving script that lets players dive beneath the surface, explore sunken shipwrecks, and loot submerged treasure chests for gold and silver rewards. Includes an oxygen system, custom scripted underwater camera, row boat rental, and a leaderboard — all integrated with RSG-Core.
---
## Features
- **Custom Underwater Diving System**
- Scripted third-person underwater camera with full mouse look
- Hold `CTRL` to dive deeper, hold `SPACEBAR` to rise
- Real-time depth display via RDR2 native prompt UI
- Sea-floor detection prevents clipping through terrain
- Dynamic underwater lighting (directional, torch-style)
- **Oxygen System**
- NUI oxygen bar appears when submerged
- Oxygen depletes over time (configurable rate — default ~50 seconds)
- Warning notification at 10% oxygen
- Player drowns and dies if oxygen reaches 0%
- Oxygen refills automatically at the surface
- **Sunken Ships**
- Sunken wreck props spawned at configurable locations on resource start
- Fully client-side, cleaned up on resource stop
- **Underwater Loot Chests**
- 6 configurable chest locations with individual map blips
- `ox_target` sphere zones allow interaction while submerged
- Each chest can only be looted once per server restart
- All chests automatically reset when the resource restarts
- **Loot Rewards**
- **40% chance** — Gold Bars (10 per chest, configurable)
- **60% chance** — Silver Bars (20 per chest, configurable)
- Rewards given directly to player inventory via RSG inventory
- Item box notification shown on loot
- **Dive Master NPC**
- Sailor NPC spawns near the dive site with proximity-based spawn/despawn and fade-in effect
- Map blip marks the NPC location
- `ox_target` interaction menu on the NPC
- **Row Boat Rental**
- Rent a rowing boat from the Dive Master NPC for a configurable cash cost (default $50)
- Boat spawns at a configured dock location
- Previous rental boat is automatically deleted on re-rent
- **Leaderboard**
- Top 10 players tracked by total chests looted, gold found, and silver found
- Viewable via the Dive Master NPC
- NUI leaderboard panel (closeable)
- **Admin Command**
- `/resetdivechests` — Manually resets all chest loot states (Admin only)
- **Quality of Life**
- Infinite swim stamina (configurable)
- Boat invincibility while occupied (configurable)
- No-sink protection for boats
- Full locale/translation support (`locales/en.lua`)
- Debug mode toggle in config