> 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/environment-animations.md).

# Environment animations

### 🟦 Client Side

#### 🔌 Exports

* **Search for Area Animations:**

  ```lua
  exports.bt_interaction:ResearchInteraction()
  ```

  This function scans for available NPC animations in your current area.

  * If you are transformed into an animal (bear, horse, deer, donkey, etc.), it will show potentially compatible animations for your current animal form.
  * As a human or animal, the displayed animations may not always be executable, depending on game constraints.

#### 📝 Functions & Variables

* **Get Current Animation:**

  ```lua
  currentAnimation(animModel, animName)
  ```

  Returns the model and name of the animation currently played by the player.
* **Animation State Boolean:**

  ```lua
  IsPlayingAnimation
  ```

  * `true` when the player is playing an animation.
  * `false` as soon as the player stops or changes animation.

#### Example Usage

```lua
function currentAnimation(animModel, animName)
    Citizen.CreateThread(function()
        while playerIsPlayingAnimation do
            Citizen.Wait(0)
            if animModel == "PROP_HUMAN_PUMP_WATER_BUCKET" or animModel == "PROP_HUMAN_PUMP_WATER" then
                if GetGameTimer() % 500 == 0 then
                    SendNotification(animName .. " gave you water + 1")
                    TriggerServerEvent("vorp:GiveMeWater") -- (example, not implemented here)
                    TriggerServerEvent("redem:GiveMeWater") -- (example, not implemented here)
                end
            end
        end
    end)
end
```

***

### ⚙️ Configuration Example (`config.lua`)

```lua
Config = {
    enable_command           = true,                 -- Enable the interaction command
    botiv_interaction_cmd    = "interact",           -- Command name
    enable_control           = true,                 -- Enable control for animation research
    InteractControl          = 0x760A9C6F,           -- (G key)
    InteractMode             = "press",              -- Use "press" or "hold" for activation
    Interaction_human_input  = "Press G to stop the animation.",
    InteractAnimalControl    = 0xE7EB9185,           -- (WhistleHorseBack)
    Interaction_animal_input = "Press H to stop the animation.",
    Interaction_stop_msg     = "Cancel animation",
    Menu_title               = "Animations",
    Menu_subtitle            = "Environment",
    Play_msg                 = "Play animation :",
    Exit_msg                 = "Close",
    AnimationList            = { ... }               -- See config for the full list
}
```

***

### 📌 Notes

* **Command Activation:**\
  The interaction menu is enabled by default and can be triggered with the configured command/key (default: `G` for humans, `H` for animals).
* **Menu & Controls:**\
  Prompts, menu titles, and animation labels are all customizable in `config.lua`.
* **Advanced:**\
  You can hook into `currentAnimation` and `IsPlayingAnimation` for gameplay, roleplay, or server event logic.


---

# 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:

```
GET https://botiv.gitbook.io/rdr2/environment-animations.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.
