> For the complete documentation index, see [llms.txt](https://docs.boii.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.boii.dev/fivem-paid-resources/planting-system/guides/adding-pests-and-diseases.md).

# Adding Pests & Diseases

Pests and diseases are defined in static Lua files under `data/`.&#x20;

They apply negative effects to specific plant types and progress over time unless cured. \
These definitions are used by the growing system to apply random or conditional challenges to plants.

***

## Structure: Pests

A pest definition must include the following fields:

| Field           | Description                                                             |
| --------------- | ----------------------------------------------------------------------- |
| `plant_types`   | Array of plant keys this pest can affect (e.g. `"cabbage"`, `"tomato"`) |
| `label`         | Human-readable name                                                     |
| `severity`      | Optional severity label (informational only)                            |
| `effects`       | Tiered effect values applied per severity (`low`, `medium`, `high`)     |
| `cure`          | Required item to cure the pest (with `id`, `label`, and `amount`)       |
| `increase_rate` | How fast the severity escalates (e.g. ticks until next stage)           |

#### Example: `cabbage_loopers`

```lua
cabbage_loopers = {
    plant_types = { "cabbage", "tomato", "corn" },
    label = "Cabbage Loopers",
    severity = "low",
    effects = {
        low = { quality = 2, health = 1 },
        medium = { quality = 4, health = 3 },
        high = { quality = 6, health = 5 }
    },
    cure = { id = "organic_pesticide", label = "Organic Pesticide", amount = 1 },
    increase_rate = 4
}
```

***

## Structure: Diseases

Diseases follow the exact same structure and fields as pests.

#### Example: `downy_mildew`

```lua
downy_mildew = {
    plant_types = { "cabbage", "tomato", "corn" },
    label = "Downy Mildew",
    severity = "low",
    effects = {
        low = { quality = 2, health = 1 },
        medium = { quality = 4, health = 2 },
        high = { quality = 6, health = 3 }
    },
    cure = { id = "copper_fungicide", label = "Copper Fungicide", amount = 1 },
    increase_rate = 5
}
```

***

## Effects Table

The `effects` table defines what penalties are applied to the plant per severity tier.

Each tier must include:

* `quality`: Reduction in final yield quality
* `health`: Reduction in overall plant health

These values are cumulative and applied when the condition escalates.

***

## Cure Field

The `cure` field defines which item is required to remove the pest or disease. Structure:

```lua
cure = {
    id = "item_name",
    label = "Item Label",
    amount = 1
}
```

This item must exist in your inventory system.

***

## Increase Rate

This value determines how quickly the condition escalates to a higher severity level. \
Lower values escalate faster.

```lua
increase_rate = 4 -- escalates every 4 ticks
```

***

## Registering New Pests or Diseases

To add a new entry:

1. Open `data/pests.lua` or `data/diseases.lua`.
2. Add a new key to the returned table.
3. Define the structure following the format above.
4. Ensure `plant_types` includes only valid keys from `data/plants.lua`.

***

## Example: Adding a New Disease

```lua
powdery_mildew = {
    plant_types = { "tomato" },
    label = "Powdery Mildew",
    severity = "low",
    effects = {
        low = { quality = 2, health = 1 },
        medium = { quality = 4, health = 2 },
        high = { quality = 6, health = 3 }
    },
    cure = { id = "sodium_bicarbonate", label = "Sodium Bicarbonate", amount = 1 },
    increase_rate = 5
}
```

Add this to the return table in `data/diseases.lua`.\
Pests follow the same format.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.boii.dev/fivem-paid-resources/planting-system/guides/adding-pests-and-diseases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
