> For the complete documentation index, see [llms.txt](https://docs.bestway.com.ua/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bestway.com.ua/game-settings/wind-behavior-settings.md).

# Wind behavior settings

## Object wind sensitivity

### Wind sensibility parameter

The `wind_sensibility` parameter defines the sensitivity level of scene entities to wind.\
It is specified in configuration files using the following syntax:

> **Syntax:**
>
> ```
> {wind_sensibility X}
> ```

Parameter values (`Х`):

* `0` — wind disabled (default);
* `1` — low sensitivity (e.g., for trees);
* `3` — high sensitivity (e.g., for grass).

### Configuring wind\_sensibility parameter

The `wind_sensibility` parameter is defined in the following configuration files:

* **properties/tree.inc** — for trees;
* **properties/bush.inc** — for bushes;
* **properties/grass.inc** — for grass;
* or in the entity's **.def** file.

<details>

<summary>Example: Configuring <code>wind_sensibility</code> for bush entities</summary>

```
{wind_sensibility 2}
```

</details>

{% hint style="success" %}
Adding the `no_wind` property to the `props` block of an entity's **.def** file turns off the entity's ability to react to wind
{% endhint %}

## Controlling an entity's ability to interact with wind through scripts

The `depend_on_wind` command is a script function that enables or disables an entity's ability to interact with wind.\
It is used in script files located in the **scene\set\interaction\_entity** folder, which define entity interactions with other scene objects during gameplay.

> Syntax:
>
> ```
> {depend_on_wind [0|1]}
> ```

Parameter value&#x73;**:**

* `0`: disables the entity's ability to interact with wind;
* `1`: enables the entity's ability to interact with wind.

The `depend_on_wind` command dynamically manages the wind interaction state of an entity based on gameplay conditions.\
For instance, if an entity transitions to a state where it should no longer respond to wind (e.g., after being destroyed or burned), the `{depend_on_wind 0}` command can be invoked to disable wind interaction.

Below is an example script demonstrating how to manage an entity's sensitivity to wind during gameplay.

<details>

<summary>Example: Entity's interaction with wind based on its state</summary>

```plaintext
{on "update_wind"
    {if flag "bare"
        {depend_on_wind 0}
    else fallen
        {depend_on_wind 0}
    else
        {depend_on_wind 1}
    }
}
```

Explanation:

* `on "update_wind"`: Event triggered to update the entity's wind sensitivity.
* Conditions:
  * if the `bare` flag is active, wind response is disabled (`depend_on_wind 0`);
  * if the entity is in a fallen state, wind response is also disabled;
  * otherwise, the entity responds to wind (`depend_on_wind 1`).

</details>

## Configuring wind parameters

The wind parameters are configured in the `main/scene/set/wind.set` file.

**Wind parameter descriptions:**

| `global_wind_speed`            | Animation speed of wind gust textures, measured in units per frame.                                                    |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `tree_bend_offset`             | Base angle of tree bending towards the wind direction, excluding gusts, measured in degrees.                           |
| `tree_bend_range`              | Maximum angle range of tree bending during gusts, measured in degrees.                                                 |
| `grass_bend_gust_start`        | Minimum wind gust threshold for grass animation, value range `[-1..1]`.                                                |
| `grass_bend_gust_end`          | Maximum wind gust threshold for grass animation, value range `[-1..1]` (must be greater than `grass_bend_gust_start`). |
| `grass_bend_angle_offset`      | Base angle of grass bending towards the wind direction, excluding gusts, measured in degrees.                          |
| `grass_bend_angle_range`       | Grass bending angle range during gusts, measured in degrees. Avoid values that visually bury grass under the ground.   |
| `grass_bend_angle_power`       | Amplitude of grass oscillations during gusts, measured in degrees.                                                     |
| `grass_bend_angle_freq`        | Frequency of grass oscillations during gusts, measured in arbitrary units.                                             |
| `grass_large_scale_power`      | Intensity of large-scale grass wave oscillations without gusts, value range `[0..1]`.                                  |
| `grass_large_scale_gust_power` | Intensity of large-scale grass wave oscillations during maximum gusts, value range `[0..1]`.                           |
| `grass_large_scale_freq`       | Frequency of large-scale grass wave oscillations, measured in arbitrary units.                                         |
| `grass_small_scale_power`      | Intensity of small-scale grass wave oscillations without gusts, value range `[0..1]`.                                  |
| `grass_small_scale_gust_power` | Intensity of small-scale grass wave oscillations during maximum gusts, value range `[0..1]`.                           |
| `grass_small_scale_freq`       | Frequency of small-scale grass wave oscillations, measured in arbitrary units.                                         |

### Step-by-step setup of wind parameters

{% hint style="info" %}
Each wind parameter is tied to a value table, configured according to the **Beaufort scale**, which maps real-world wind conditions to in-game effects:

* `0`: no wind (calm);
* `10`: storm-level wind strength.
  {% endhint %}

1. Set the `global_wind_speed` parameter
2. Configure tree wind parameters: `tree_bend_offset`, `tree_bend_range`
3. Configure grass parameters:
   * `grass_bend_gust_start`, `grass_bend_gust_end`;
   * `grass_bend_angle_offset`, `grass_bend_angle_range`;
   * `grass_bend_angle_freq`, `grass_bend_angle_power`;
   * `grass_large_scale_*`, `grass_small_scale_*`.

Below is an example of configuring the `grass_small_scale_power` parameter using a value table based on the **Beaufort scale**. This parameter adjusts the intensity of small-scale grass wave oscillations in response to varying wind conditions.

{% hint style="info" %}
Configure other parameters similarly to ensure consistent wind responses.
{% endhint %}

<details>

<summary>Example: Configuring wind parameters</summary>

```plaintext
{grass_small_scale_power
    0  0.004 ; value for calm wind
    1  0.010
    2  0.014
    3  0.020
    4  0.026
    5  0.032
    6  0.040
    7  0.050
    8  0.060
    10 0.100 ; value for hurricane
}
```

Description:

* Key: represents the Beaufort scale level (0 for calm, 10 for hurricane).
* Value: adjusts the intensity of small-scale oscillations in grass, measured in arbitrary units.
* Usage: these values define how grass reacts to different wind strengths, creating a realistic animation effect.

</details>

### Console commands

For diagnosing and controlling wind effects during gameplay, the following console commands are available:

* Reload wind settings from the `wind.set` file:

```
ed_reloadWind
```

* Display entities' wind sensitivity on screen:

```
v_entityWind [0 | 1]
```

<figure><img src="https://2358506489-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2UV9d5d9aTZPISbocWyo%2Fuploads%2FrlBauPh7Ds4St0HVys7e%2Fv_entityWind.png?alt=media&amp;token=76a464e4-e863-424f-a5ec-d8acb868475f" alt=""><figcaption><p>Displaying entities' wind sensitivity on screen using the <code>v_entityWind</code> command.</p></figcaption></figure>
