Berry planting

This page describes how **berry plants** work, along with accessories like mulch and watering cans.

## Berry plant patches

Berries can only be planted in special patches in the overworld. In Essentials, each patch is an event set up in a particular way. Every berry plant patch event must have "BerryPlant" in its name; this allows the event's graphic to be automatically updated depending on which berry is planted and its state of growth.

An empty berry plant patch will simply be an event with no graphic, set to "Stop Animation" and a trigger of Action Button. There is a single command on a single page, which is:

```
@>Script: pbBerryPlant

```

Some berry plant patches can start off containing a fully-grown berry plant. These will remain there forever until they are picked. They have two pages, the second of which is the same as above but it also has the condition of Self Switch A being ON. The first page has a graphic of the berry plant, set to "Stop Animation" and "Direction Fix" (to avoid it changing its appearance when interacted with), and a trigger of Action Button. On the first page is a single command, which is:

```
@>Script: pbPickBerry(:ORANBERRY, 2)

```

The two parameters for this script are the item obtained from that plant, and the quantity. This script automatically sets the event's Self Switch A to ON when the item(s) have been picked from the plant.

## PBS file "berry\_plants.txt"

Every berry plant must be defined in the PBS file "berry\_plants.txt", or a PBS file named "berry\_plants\_XYZ.txt" (where "XYZ" is any text). Each section in this file is one separate berry plant, where a section begins with a line containing an item ID in square brackets and ends when the next section begins. Each line in a section is one separate piece of information about that berry plant.

Aside from the ID line, every line in a section follows the format:

```
XXX = YYY

```

where XXX is a property and YYY is the value or values associated with it (the spaces are optional). For example:

```
[CHERIBERRY]
HoursPerStage = 3
DryingPerHour = 15
Yield = 2,5
#-------------------------------
[WEPEARBERRY]
HoursPerStage = 2
DryingPerHour = 35
Yield = 2,10
#-------------------------------
[OCCABERRY]
HoursPerStage = 18
DryingPerHour = 6
Yield = 1,5

```

Each berry plant is associated with the item it yields.

 HoursPerStage
 DryingPerHour
 Yield

## Plant graphics

When planted, a berry will progress through five growth stages. Each growth stage lasts the same amount of time, although how long that is depends on the berry. These stages are:

1. Planted
2. Sprouting (berries which replant themselves start off at this stage)
3. Growing
4. Flowering
5. Berries available for picking

The graphics used for the berry plants are in the folder "Graphics/Characters". They are charsets, as they are used as the graphics for events. The first stage is the same for all berry plants, and is the file `berrytreeplanted.png`. Each berry plant then has its own charset for the other four stages, called `berrytree_XXX.png`, where "`XXX`" is the ID of the berry item. The four stages are in order from top to bottom.

There are also three soil moisture graphics in the same folder, which are displayed underneath a berry plant (which the player has planted). These are only shown if the newer berry plant mechanics are being used (see below). They are the files `berrytreedry.png`, `berrytreedamp.png` and `berrytreewet.png`, and they are *not* charsets.

## Mechanics

There are two sets of mechanics in Essentials for how berry plants work: those used in the Gen 3 games, and those used in the Gen 4 games. There are two settings related to berry plants, one of which determines which set of mechanics are used:

```
# mechanics (false).
NEW_BERRY_PLANTS  = (MECHANICS_GENERATION >= 4)

```

The second setting defines which animation appears over a berry plant when it grows while the player is nearby:

```
# is on the map (for new plant growth mechanics only).
PLANT_SPARKLE_ANIMATION_ID   = 7

```

The mechanics and calculations for berry plant growth, as well as how watering cans and mulch items work, are the same as the official games. They do not need to be described here.

The berry plant event's variable contains an instance of `class BerryPlantData`, which contains information that describes the plant.

A berry plant will use the old or new mechanics that were in effect when it was planted, even if the setting that determines this is changed later.

## Tips

* While berries are traditionally the only things that can be planted, you could have different kinds of items to plant and grow instead/as well. For example, crystal shards that grow into larger crystals from which multiple shards can be obtained, or other kinds of vegetation such as moss, vines and fungi.
	+ Note that you will likely need to make changes to the code if you want to have more than one significantly different kind of plantable item (e.g. berries and crystals). For example, crystals may grow in different places to berries, may use different kinds of mulch/watering can items (if any), and may display different messages when interacting with them.
* The Gen 6 games made significant differences to the berry plant mechanics, adding new mulch items and making it possible to cross-breed two berry plants to create new kinds of berries. These mechanics are not available in Essentials, but you could add them yourself.