> ## Documentation Index
> Fetch the complete documentation index at: https://docs.r-scripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Maps

> Guide to creating custom FFA arenas and weapon loadouts

## Map Structure

R\_FFA uses two separate configurations:

1. **Maps** - Define available maps with weapons and settings
2. **Arenas** - Define physical arena locations and zones

## Creating a Map

Add to `R.Maps` in `config.lua`:

```lua theme={null}
R.Maps = {
    {
        Name = "Pistol Arena",
        Image = "https://your-image-url.png",
        Description = "Only pistols allowed",
        Weapons = {
            "weapon_pistol",
            "weapon_pistol_mk2",
            "weapon_combatpistol",
        },
        MaxPlayers = 20,
        UseArmor = true,
        MapId = 1, -- Must match Arena
    },
}
```

### Map Parameters

| Parameter     | Type    | Description                |
| ------------- | ------- | -------------------------- |
| `Name`        | string  | Display name of the map    |
| `Image`       | string  | URL to map image           |
| `Description` | string  | Short description          |
| `Weapons`     | table   | List of weapon spawn names |
| `MaxPlayers`  | number  | Maximum players allowed    |
| `UseArmor`    | boolean | Give players armor         |
| `MapId`       | number  | Links to Arena             |

## Creating an Arena

Add to `R.Arenas` in `config.lua`:

```lua theme={null}
R.Arenas = {
    {
        Name = "Pistol Arena",
        Image = "https://your-image-url.png",
        Route = 3131456579, -- route for that arena (do not use same for 2)
        Is1v1Map = false,

        -- 1v1 spawn points (required for 1v1 maps)
        P1Spawn = vector3(-268.64, -1584.75, 31.84),
        P2Spawn = vector3(-262.80, -1556.67, 31.84),

        -- FFA spawn points
        SpawnPoints = {
            vec3(-58.20, 6487.37, 31.50),
            vec3(-40.94, 6456.73, 35.25),
            vec3(-42.51, 6415.77, 31.49),
        },

        -- Arena zone
        ZoneType = "Sphere",
        RadiusOrThickness = 90.0,
        Coords = vec3(-111.86, 6421.03, 31.43),
    },
}
```

### Arena Parameters

| Parameter           | Type    | Description                      |
| ------------------- | ------- | -------------------------------- |
| `Name`              | string  | Must match Map name              |
| `Image`             | string  | URL to arena image               |
| `Route`             | number  | Use different route for each map |
| `Is1v1Map`          | boolean | Enable 1v1 mode                  |
| `P1Spawn`           | vector3 | Player 1 spawn (1v1)             |
| `P2Spawn`           | vector3 | Player 2 spawn (1v1)             |
| `SpawnPoints`       | table   | List of FFA spawn points         |
| `ZoneType`          | string  | "Sphere" or "Poly"               |
| `RadiusOrThickness` | number  | Zone size/thickness              |
| `Coords`            | vector3 | Zone center                      |

## Getting Coordinates

<Steps>
  <Step title="Go to Location">
    Travel to your desired arena location
  </Step>

  <Step title="Get Coordinates">
    Use a coordinate script or command like `/coords`
  </Step>

  <Step title="Copy Values">
    Copy the coordinates
  </Step>

  <Step title="Add to Config">
    Paste into your arena configuration
  </Step>
</Steps>

## Example: Creating a 1v1 wager Map

```lua theme={null}
-- Add to R.Arenas 

{
    Name = "1v1 Pistols",
    Image = "https://example.com/1v1.png",
    Route = 9457459283,
    Is1v1Map = true,

    P1Spawn = vector3(100.0, 200.0, 30.0),
    P2Spawn = vector3(110.0, 200.0, 30.0),

    SpawnPoints = {
        vector3(100.0, 200.0, 30.0),
        vector3(110.0, 200.0, 30.0),
    },

    ZoneType = "Sphere",
    RadiusOrThickness = 25.0,
    Coords = vec3(105.0, 200.0, 30.0),
}
```

## Weapon Configuration

Available weapons for custom lobbies / wagers are defined in `R.Weapons`:

```lua theme={null}
R.Weapons = {
    "weapon_pistol",
    "weapon_pistol_mk2",
    "weapon_vintagepistol",
    "weapon_combatpistol",
    -- Add more weapons here
}
```

### Weapon Labels

Customize weapon names:

```lua theme={null}
R.WeaponLabels = {
    weapon_pistol = "Pistol",
    weapon_pistol_mk2 = "Pistol MK2",
    -- Add more labels
}
```

## Component Images

Customize weapon component icons:

```lua theme={null}
R.ComponentImages = {
    suppressors = 'nui://ox_inventory/web/images/at_suppressor_light.png',
    extended_clips = 'nui://ox_inventory/web/images/at_clip_extended_pistol.png',
    grips = 'nui://ox_inventory/web/images/at_grip.png',
    scopes = 'nui://ox_inventory/web/images/at_scope_small.png',
    flashlights = 'nui://ox_inventory/web/images/at_flashlight.png',
    magazines = 'nui://ox_inventory/web/images/at_clip_drum_rifle.png'
}
```

## Zone Types

### Sphere Zone

Simple circular zone:

```lua theme={null}
ZoneType = "Sphere",
RadiusOrThickness = 50.0, -- Radius
Coords = vec3(0.0, 0.0, 0.0), -- Center point
```

### Polygon Zone

Complex shaped zone (future feature):

```lua theme={null}
ZoneType = "Poly",
RadiusOrThickness = 5.0, -- Wall thickness
-- Define polygon points
```

## Testing Your Map

<Steps>
  <Step title="Enable Debug">
    ```lua theme={null}
    R.ZoneDebug = true
    ```
  </Step>

  <Step title="Restart Resource">
    ```
    ensure r_ffa
    ```
  </Step>

  <Step title="Join Arena">
    Join your new map and test spawn points
  </Step>

  <Step title="Check Zones">
    Verify the zone boundaries are correct
  </Step>

  <Step title="Disable Debug">
    ```lua theme={null}
    R.ZoneDebug = false
    ```
  </Step>
</Steps>

## Tips

<Tip>
  * Start with small arenas (20-30m radius)
  * Test spawn points don't overlap
  * Balance armor with weapon power
  * Add multiple spawn points to prevent camping
</Tip>

<Card title="Configuration Guide" icon="gear" href="/r_ffa/configuration">
  Back to configuration
</Card>
