# Recipes

How to create and configure recipes

***

````markdown
---
description: How to create and configure recipes
---

# 📜 Recipes

**File:** `config/recipes.lua`

## Recipe Structure

```lua
{
    id            = 'lockpick',              -- Unique recipe ID
    label         = 'Lockpick',              -- Display name
    description   = 'Used to pick locks.',   -- Description text
    category      = 'workbench',             -- Must match table type
    result        = {
        item     = 'lockpick',               -- Result item name
        count    = 1,                        -- Result item count
        isWeapon = false,                    -- true for weapons
    },
    ingredients   = {
        {item = 'iron',    label = 'Iron',    count = 3},
        {item = 'plastic', label = 'Plastic', count = 2},
    },
    craftTime     = 5,                       -- Base craft time (seconds)
    successRate   = 85,                      -- Base success rate (%)
    xpReward      = 10,                      -- XP on success
    bonusItem     = true,                    -- Enable bonus item chance
    materialSave  = true,                    -- Enable material save chance
    needBlueprint = false,                   -- Require blueprint
    blueprintItem = nil,                     -- Blueprint item name
    requiredLevel = 0,                       -- Minimum level (0 = no lock)
    image         = 'lockpick.png',          -- Image in html/images/
}
````

### Categories

Recipes are filtered by category. Each craft table has a `type` that must match:

| Table Type    | Shows Recipes With       |
| ------------- | ------------------------ |
| `'workbench'` | `category = 'workbench'` |
| `'cooking'`   | `category = 'cooking'`   |
| `'weapon'`    | `category = 'weapon'`    |
| `'all'`       | All recipes              |

### Default Recipes

#### Workbench

| Recipe     | Ingredients                          | Time | Success | Level |
| ---------- | ------------------------------------ | ---- | ------- | ----- |
| Lockpick   | 3x Iron, 2x Plastic                  | 5s   | 85%     | 0     |
| Radio      | 5x Electronic, 3x Plastic, 2x Copper | 10s  | 75%     | 5     |
| Repair Kit | 5x Iron, 3x Rubber, 2x Plastic       | 8s   | 80%     | 3     |

#### Cooking

| Recipe    | Ingredients                   | Time | Success | Level |
| --------- | ----------------------------- | ---- | ------- | ----- |
| Hamburger | 1x Bread, 1x Meat, 1x Lettuce | 6s   | 90%     | 0     |
| Sandwich  | 2x Bread, 1x Cheese           | 3s   | 95%     | 0     |

#### Weapon

| Recipe      | Ingredients                               | Time | Success | Level |
| ----------- | ----------------------------------------- | ---- | ------- | ----- |
| Pistol Ammo | 5x Iron, 3x Gunpowder                     | 8s   | 90%     | 10    |
| Pistol      | 15x Iron, 10x Steel, 3x Rubber, 2x Spring | 30s  | 50%     | 25    |

### Adding a New Recipe

#### Step 1: Add to config/recipes.lua

```
{
    id            = 'armor',
    label         = 'Body Armor',
    description   = 'Protective body armor.',
    category      = 'workbench',
    result        = {item = 'armor', count = 1, isWeapon = false},
    ingredients   = {
        {item = 'steel',   label = 'Steel',   count = 10},
        {item = 'plastic', label = 'Plastic', count = 5},
        {item = 'rubber',  label = 'Rubber',  count = 3},
    },
    craftTime     = 15,
    successRate   = 70,
    xpReward      = 30,
    bonusItem     = false,
    materialSave  = true,
    needBlueprint = false,
    blueprintItem = nil,
    requiredLevel = 15,
    image         = 'armor.png',
}
```

#### Step 2: Register the item

Register `armor` in your inventory system (see Items & Jobs Setup).

#### Step 3: Add image

Place `armor.png` in `html/images/` folder.

#### Step 4: Restart

```
ensure elenacraft
```

### Weapon Recipes

For weapon recipes, set `isWeapon = true`:

```
result = {item = 'WEAPON_PISTOL', count = 1, isWeapon = true},
```

Weapon item names must match your inventory system. For ox\_inventory, use lowercase: `weapon_pistol`. For ESX, use uppercase: `WEAPON_PISTOL`.

### Blueprint Recipes

To require a blueprint:

```
needBlueprint = true,
blueprintItem = 'blueprint_pistol',
```

Players can learn blueprints by:

1. Having the blueprint item in inventory and clicking "Learn" in the UI
2. Admin command: `/craftblueprint [id] [item]`
3. Admin UI panel

### Level Locked Recipes

Set `requiredLevel` to lock a recipe behind a level:

```
requiredLevel = 25,    -- Player must be level 25+
```

Locked recipes show a 🔒 icon and cannot be crafted until the player reaches the required level.


---

# Agent Instructions: 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://elena-scripts.gitbook.io/elenascripts/gameplay/craft-system/recipes.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.
