# Deadwood Stage Line
A **RedM** (Red Dead Redemption 2) resource for **RSG-Core** that adds a fully-featured stagecoach escort mission. Players form a group, escort a stagecoach from Deadwood to its destination, defend against robber ambushes, and earn rewards based on surviving passengers.
## Features
- **Group System** — Create or join escort groups (up to 8 players), with group leader controls
- **Stagecoach with Driver & Passengers** — Spawns a stagecoach with an AI driver and up to 3 passengers who must be protected
- **Stagecoach Controls** — Start, speed up, slow down, halt, and hold position via target interaction or NUI menu
- **Robber Ambushes** — Pre-defined attack locations trigger bandit ambushes on horseback; some dismount to attack the coach
- **Driver Death Timer** — If the driver is killed, players have 60 seconds to take the reins or the mission fails
- **Spook / Calm Mechanics** — The stagecoach panics during robber attacks and calms once threats are eliminated
- **Passenger Survival Tracking** — Each surviving passenger earns a bonus reward
- **GPS Routing & Blips** — Multi-route GPS and blips guide players to the stagecoach and destination
- **NUI Clipboard Menu** — A themed HTML/JS UI styled as a Wild West wanted poster / clipboard
- **Locale / i18n** — Full translation-ready locale system with English included
- **Death Tracking** — If all group members die, the mission ends
- **Configurable** — Locations, spawn points, rewards, speeds, bandit settings, blips and more
## Installation
1. **Download** the `deadwood-stage` folder
2. **Place** it in your server's `resources` directory
3. **Add** to your `server.cfg`:
```
ensure deadwood-stage
```
4. **Ensure** dependencies are loaded before this resource
## Dependencies
- [RSG-Core](https://github.com/Rexshack-RedM/rsg-core) — Required RedM framework
- `bln_notify` — Notification system
- `rsg-target` — Target interaction system
## Configuration
Edit `config.lua`:
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `Debug` | `bool` | `true` | Enable debug logging |
| `TestMode` | `bool` | `false` | Skip minimum player check |
| `Locale` | `string` | `'en'` | Language locale |
| `StartLocation` | `vector3` | Deadwood coords | Mission start position |
| `EndLocation` | `vector3` | destination coords | Mission destination |
| `SpawnPoints` | `vector4[]` | Deadwood | Stagecoach spawn location |
| `WagonModel` | `string` | `"stagecoach001x"` | Stagecoach vehicle model |
| `MinPlayers` | `int` | `1` | Minimum players to start |
| `MaxPlayers` | `int` | `8` | Maximum group size |
| `WagonReward` | `int` | `2000` | Base reward per player |
| `PassengerReward` | `int` | `500` | Bonus per surviving passenger |
| `DriverDeathTimer` | `int` (ms) | `60000` | Time to take reins after driver dies |
| `BanditAttackLocations` | `table` | 2 locations | Points where robber ambushes trigger |
## Usage
1. Approach the start NPC in Deadwood and select **"Start Stagecoach Mission"**
2. **Create a group** (leader) or **join** an existing group via Group ID
3. Leader clicks **"Start Mission"** — the stagecoach spawns with a driver and passengers
4. Approach the stagecoach and use **"Start Stagecoach"** to begin the journey
5. Use speed controls, halt, or hold position as needed
6. **Defend** the stagecoach from robber ambushes at predefined locations
7. If the driver dies, **take the reins** to continue
8. Reach the destination alive to earn rewards based on surviving passengers
## Resource Structure
```
deadwood-stage/
├── fxmanifest.lua # Resource manifest
├── config.lua # All configurable settings
├── client/
│ └── client.lua # Client logic (spawning, controls, combat, UI)
├── server/
│ └── server.lua # Server logic (groups, missions, rewards)
├── shared/
│ ├── locales.lua # Locale loader
│ └── utils.lua # Shared utility functions
├── locales/
│ └── en.lua # English translations
└── html/
├── index.html # NUI clipboard menu
├── script.js # NUI interactions
├── style.css # Themed styling
├── font/crock.ttf # Western-style font
└── img/clipboard.png # Clipboard background
```
## Events
### Server Events
| Event | Description |
|-------|-------------|
| `deadwood-stage:server:createGroup` | Create a new escort group |
| `deadwood-stage:server:joinGroup` | Join an existing group |
| `deadwood-stage:server:startMission` | Start the mission (leader only) |
| `deadwood-stage:server:endMission` | End mission / leave group |
| `deadwood-stage:server:completeMission` | Trigger reward payout |
| `deadwood-stage:server:triggerBanditAttack` | Trigger a bandit ambush |
| `deadwood-stage:server:playerDied` | Track player death |
| `deadwood-stage:server:playerRespawned` | Track player respawn |
| `deadwood-stage:server:createRouteGPS` | Send GPS route to group |
### Client Events
| Event | Description |
|-------|-------------|
| `deadwood-stage:client:openMenu` | Open the NUI menu |
| `deadwood-stage:client:spawnStagecoach` | Spawn stagecoach for the group |
| `deadwood-stage:client:missionStarted` | Notification that mission has started |
| `deadwood-stage:client:spawnBanditsLeader` | Spawn bandits (leader client) |
| `deadwood-stage:client:banditAttackNotify` | Bandit attack notification (non-leaders) |
| `deadwood-stage:client:takeReins` | Take control of the stagecoach |
| `deadwood-stage:client:startCompletion` | Begin mission completion sequence |
| `deadwood-stage:client:missionFailed` | Handle mission failure |
| `deadwood-stage:client:cleanup` | Clean up all entities |