> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_zombies/spawn-areas.md).

# Spawn Areas

Zombies spawn inside rectangles called **grids**, set in `Config.squares.grids`. They appear where a grid covers, and nowhere else.

The default config has two grids: **Los Santos & Blaine County** and **Cayo Perico**. Add, remove, or resize grids to control where zombies show up.

{% hint style="info" %}
This page covers the map-wide grids only. Danger zones spawn their own zombies (no grid needed), and safe zones block spawns even inside a grid. Both are in the [FAQ](/docs/assets/5s_zombies/faq.md).
{% endhint %}

## Two ways to describe a grid

A grid is a rectangle. Describe it whichever way is easier, both give the same result.

### 1. Centre point + sizes

A centre point, plus half the width (X) and half the length (Y) in meters.

```lua
{
    center = vector3(125.0, 100.0, 30.0),
    totalSizeX = 1325, -- half the width
    totalSizeY = 1000, -- half the length
    size = 250,
    onlyPavement = false,
    dontSpawnInInterior = true,
    dontSpawnInWater = true,
}
```

### 2. Two opposite corners

Copy your coords in one corner, then in the diagonally opposite one.

```lua
{
    pointA = vector3(-1200.0, -900.0, 30.0), -- one corner
    pointB = vector3(1450.0, 1100.0, 30.0),  -- diagonally opposite corner
    size = 250,
    onlyPavement = false,
    dontSpawnInInterior = true,
    dontSpawnInWater = true,
}
```

Both examples describe the same rectangle.

## Grid options

Fields on each grid:

| Field                 | What it does                                                                       |
| --------------------- | ---------------------------------------------------------------------------------- |
| `size`                | Sector size in meters. Zombies spawn around the player's current sector.           |
| `onlyPavement`        | `true` = roads and pavement only. Use `false` on custom maps without GTA pavement. |
| `dontSpawnInInterior` | `true` = no spawns inside interiors (buildings, tunnels).                          |
| `dontSpawnInWater`    | `true` = no spawns in water.                                                       |

Two fields sit on `Config.squares` itself:

| Field       | What it does                                                                   |
| ----------- | ------------------------------------------------------------------------------ |
| `drawDebug` | `true` = draw grid squares in the world to check coverage. Turn off when done. |
| `height`    | Sector height in meters. Default 1000 covers bridges and tunnels.              |

## Limit zombies to one area

To keep zombies in one area, delete the grids you don't want. For **Cayo Perico only**, remove the Los Santos grid:

```lua
Config.squares = {
    drawDebug = false,
    height = 1000,
    grids = {
        {
            -- Cayo Perico
            center = vector3(4818.7, -5031.9, 20),
            totalSizeX = 2000,
            totalSizeY = 1200,
            size = 200,
            onlyPavement = false,
            dontSpawnInInterior = true,
            dontSpawnInWater = true,
        }
    }
}
```

Two things to remember:

* **Danger zones spawn on their own.** The default config has mainland danger zones (Humane Labs, Bolingbroke, Fort Zancudo, and more). They ignore grids, so clear or move `Config.zones.dangerZones` too, or zombies still appear on the mainland.
* **Keep `Config.threadSettings.spawnPedsAllOverMap = true`.** It means "everywhere the grids cover", now just Cayo Perico. Set it to `false` only if you want zombies in danger zones and nowhere else: the grids turn off, but danger zones keep spawning.

## Add a new area or custom map

Add another grid to `Config.squares.grids` covering your area (either style works):

```lua
Config.squares = {
    drawDebug = false,
    height = 1000,
    grids = {
        {
            -- My custom map
            center = vector3(125.0, 100.0, 30.0),
            totalSizeX = 1325,
            totalSizeY = 1000,
            size = 250,
            onlyPavement = false,
            dontSpawnInInterior = true,
            dontSpawnInWater = true,
        }
    }
}
```

A few tips for custom maps:

* **Use `onlyPavement = false`.** Custom maps often lack GTA pavement flags, so `true` can leave zombies with nowhere to spawn.
* **Density falls back to `Config.defaultArchetype`.** Archetypes match GTA zone names, which custom maps rarely change, so most custom areas use the default.
* **One grid per landmass.** Don't stretch one rectangle over empty ocean. Use a separate grid per island or area, like Los Santos and Cayo Perico.

## Check your area in-game

Not sure your rectangle is right? Set `drawDebug = true` in `Config.squares`:

```lua
Config.squares = {
    drawDebug = true,
    -- ... rest of your config
}
```

Grid squares near you show up in the world, your current one in red. No outlines where you stand = that spot is outside every grid, so no zombies there. Turn it off when the coverage looks right.
