> For the complete documentation index, see [llms.txt](https://botiv.gitbook.io/rdr2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://botiv.gitbook.io/rdr2/chicken-coop.md).

# Chicken Coop

### ⚡ First Start

1. **Install item images**\
   Copy everything from the `_items` folder into your VORP Inventory images directory:

```
vorp_inventory\html\img\items
```

These files are the icons used for the coop, chickens and related items (e.g., `chicken_good.png`, `chicken_bad.png`, `rooster_good.png`).

2. **Prepare translations**\
   Open `config.lua` and translate two areas:

* **Database items** in `createItems()` → set `label` (item name) and `desc` (item description). These values are inserted into VORP’s `items` table at server start.
* **UI texts** in `Config.Txt`, and pick your UI language via `Config.NUILang` (supported: **fr, en, de, it, es, pt**).

> Tip: Start/Restart the server to let `createItems()` run and (re)inject the items into the database. (This follows from the script inserting items “when the server starts.”)

***

### 🧩 Database Items (createItems)

In `config.lua`, edit `createItems()` so your item names/descriptions match your language:

```lua
function createItems()
   exports.oxmysql:execute("INSERT INTO items (...)",
       {"chicken_good","Chicken",5,1,"item_standard",0,1,"{}","Healthy chicken",1.0,0}
   )
   -- duplicate for other items (injured chicken, rooster, meat, coop, ...)
end
```

* `label` → inventory display name (e.g., `"Chicken"`).
* `desc` → inventory tooltip/description (e.g., `"Healthy chicken"`).\
  These fields are written into the VORP `items` table at startup.

***

### 🌍 UI Localization

Set the NUI language and translate the visible strings:

```lua
-- translate.js provides: fr, en, de, it, es, pt
Config.NUILang = "en"

Config.Txt = {
  Title = "Chicken Coop",
  OpenCoop = "Open the coop",
  StallName = "Coop name",
  -- ...
}
```

* `Config.NUILang` selects the language used by the NUI (front-end).
* `Config.Txt` holds the text displayed to players in the interface.

***

### ✅ Quick Checklist

* `_items` → `vorp_inventory\html\img\items` copied.
* `createItems()` labels/descriptions translated.
* `Config.NUILang` set and `Config.Txt` translated.

You’re ready to launch the script and see the coop items and UI in your chosen language.

<mark style="color:green;">Here is an excerpt from the config.lua file : (parts of the excerpt are hidden) :</mark>&#x20;

<pre class="language-lua"><code class="lang-lua">Config = {}
Config.DEBUG = false -- 5s = 1 day
Config.SpamSeconds = 2

-- KEYBIND CONFIGURATION
Config.OpenCoop       = keys["U"]        -- Key to open a chicken coop
Config.CraftObject    = keys["U"]        -- Key to place/confirm creation
Config.ChangeDistance = keys["DOWN"]     -- Move the coop closer or further when placing
Config.RotateLeft     = keys["LEFT"]     -- Rotate coop left while placing
Config.RotateRight    = keys["RIGHT"]    -- Rotate coop right while placing
Config.Cancel         = keys["R"]        -- Cancel placement

function createItems()
    --
end

-- CAPACITY &#x26; MODELS
<strong>Config.MaxAnimals = 5
</strong>Config.StreamDistance = 100.0
Config.DespawnDistance = 110.0

Config.Models = {
  --
}

Config.Items = {
    --
}

Config.FoodAllowed = {
    "corn",
    "water"
}

Config.NUILang = "en" -- translate.js -> fr, en, de, it, es, pt
-- TRANSLATED TEXTS
Config.Txt = {
    Title        = "Chicken Coop",
    OpenCoop     = "Open the coop",
     --
}

-- PRODUCTION
Config.Production = {
    Prairie    = { chance1 = 0.90, chance2 = 0.50 },
    LowChicken = { chance1 = 0.70, chance2 = 0.20 },
    RoosterChickChance = 0.10, -- per in-game day
    ChickAdultChance   = 0.10, -- per in-game day
}

-- DIRTINESS
Config.DirtDailyPerAnimalMin = 1
Config.DirtDailyPerAnimalMax = 2

-- DISEASES / DEATH
Config.SicknessAt100   = 0.10   -- per in-game day (if dirt == 100)
Config.DeathIfSick     = 0.10   -- per in-game day (sick animal)
Config.DeathIfSickChick= 0.20   -- per in-game day (sick chick)
Config.HealIfBelow100  = 0.10   -- per in-game day / sick animal (if dirt &#x3C; 100)

-- FOX EVENT (optional)
Config.EnableFoxEvent = true
Config.FoxAttackChanceNight = 0.01 -- every 5s, all night, if chickens are outside
Config.FoxKillMin = 1
Config.FoxKillMax = 1

-- IN-GAME DAY &#x26; TIME CONVERSION
-- 1s IRL = 30s IG  =>  24h IG = 48min IRL
Config.DayStartHour = 6
Config.DayEndHour   = 20
Config.RequiredOutsideFraction = 0.50
-- => 6->20 = 14h IG = 28min IRL ; threshold = 14min IRL

</code></pre>


---

# 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, and the optional `goal` query parameter:

```
GET https://botiv.gitbook.io/rdr2/chicken-coop.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
