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

# Farming

### Plant Configuration

Each plant can have its own growth time duration, temperature min-max values, fertilizers and rewards.

**Growth / Ageing:**

The plant growth - ageing is based in **minutes** and only (not in-game time). The ones you have to modify based on the existing or new plant is `GrowthAge`, `GrowthPlantStages` and `MaxPlantAge`.

1. `GrowthAge` : The growth age is the total age of a plant to reach 100% growth (for receiving - collecting the rewards). For example, if you want the total growth of this plant to be in 1 hour, you set `60` (which is 1 hour in minutes).
2. `MaxPlantAge` : The max age of the plant (not growth) - must be greater than `GrowthAge` ( > 60 ). This `MaxPlantAge` option is to remove completely a plant after reaching 100% in case it is never picked up by any player. So if the value is at `80` (which is greater than 60), the plant will die and be removed completely by the system after 1 hour and 20 minutes.
3. `GrowthPlantStages` : This option is a bit tricky and needs some understanding. I have made this option in order to provide a tricky feature for server owners to be able to create plant growth stages. Unfortunately, there is no other way unless you have multiple plant objects of the same type (custom of course) in your server, then it can be easier, but for those who don't have and want to use in-game plant objects, this is the most easiest way.

**Example & Explanation:**

```lua
        GrowthPlantStages = {
            {Model = 's_inv_wildmint01x', Age = 0,   PlacementHeight = 0.7}, -- Lowest Age
            {Model = 's_inv_wildmint01x', Age = 30,  PlacementHeight = 0.0},
            {Model = 'p_tree_orange_01',  Age = 60,  PlacementHeight = 0.5}, -- Highest Age
        },
```

For creating a plant growth stage, we start from `0` (age) up to `GrowthAge` which is `60` minutes (1 hour) as we mentioned above. Then, in game, since we know what object we want to use, the `PlacementHeight` is the Z position of the object (plant) which makes the plant to be placed higher or lower in the ground - with this way we create a "fake" growth.

### New Fertilizers

When adding on a plant a fertilizer that is not a default and does not exist, you have to do the following actions:\
\
1\.  Register the fertilizer to `Config.FertilizerTypes` configuration section.

```lua
Config.FertilizerTypes = {
    ['fertilizer'] = 250,  -- default
    ['fertilizer_manure'] = 400, -- default
    ['your_new_fertilizer'] = 500, -- your value between 0 - 1000 (this is the value to add on the plant once used)
}
```

2\. Go to `locales.lua` and add the new fertilizer locale - this is required, otherwise there will be bugs related to this plant because it will be having an invalid name.\
\
Checkout `locales.lua` where `'fertilizer'` and `'fertilizer_manure'` are located and add below the new fertilizer that you have registered.

```lua
['fertilizer']          = "Fertilizer", -- item name. -- 2.1.6
['fertilizer_manure']   = "Fertilizer Manure", -- item name. -- 2.1.6
['your_new_fertilizer'] = "Custom Fertilizer", -- <----
```

### Create Plant Zones

#### X,Y,Z Explanation (Vector3 & Vector2)

You need to understand how the configuration works related to the XYZ parts.

Through a `vector3` or a table form, you can get the X,Y,Z coordinates.

1. If its a vector3, it will look like this: `vector3(0, 0, 0) --0, 0, 0 (of vector3, represents X,Y,Z).`
2. If its a table form, it will look like this: `{ x = 0, y = 0, z = 0 .. } -- All that in a table form already represents everything we need without explanation.`

#### Vector2

In our configuration file, it requires a vector2, what is a vector2? vector2 is X,Y without the Z included (You get that also from vector3 or a table form).

So when getting the coords from a script, it will show you a vector3, you just change it into a vector2 with just X,Y inside only and not Z and the same if its a table form, you create a vector2 with X,Y that the table provides you.

#### MinZ & MaxZ

The **MinZ** and **MaxZ** that are included on the configuration when creating a zone, it means that it requires the Minimum Z position (lower point) and Maximum Z position (highest point) of a zone.

To understand better, its like a building, you define the lowest point of the building like a point underneath the player and then the highest point of this building. This is how a zone works, you define the MinZ and MaxZ of the whole zone. You can also use the **Debug** to true to display into you the shape of the created zone and the height.

#### How to create a shape of the zone?

To create a shape of a zone is actually very simple to understand, you have to think it as a paper drawing. Imagine drawing a town, a field, anything, you cannot draw it randomly can you? you need an order to draw a town or a field, because if you draw it in random spots, then the town or a field will not be called that way. This is also how to create a zone, it needs a specific order, like drawing on a paper in order to be made properly.

I personally suggest (2) ways:

1. SPOONI SPOONER: A very great script that you can just place some barrels with the design you want and get their position one by one (in order like drawing) for the vector2 coords that are required.
2. Coords script: There are plenty of coords script that you can take your player current coords through a command, this is faster for those who have a bit more experience.
