# Human death animation selection

The logic for selecting death animations for a **human** unit is stored in `\properties\animation_selector\`**`human_death.inc`**

The selector processes requests whose names match the [kill flag](/animation/animation-system-for-actor/animation-selection-setup/human-specific-conditions.md#kill-flags-reference) names that describe the circumstances of death.

#### Death animation request types

* `stand_dying` — death while standing;
* `squat_dying` — death while sitting;
* `lie_dying` — death while lying;
* `swim_dying` — death while swimming;
* `corpse_drop` and `corpse_drag` — corpse drop and dragging during death;
* `default_dying` — a special request made once, with its result stored.\
  This request should return a death animation to be played if no other is found.\
  It ensures there are no standing dead soldiers after loading.

## Death animation selection

After a death animation request is chosen (from the list above), the `if`-block conditionals check different death circumstances.

#### Possible checks:

* Death circumstance flags — `human_kill_flags`
* Terrain type — `terrain_pp`
* Equipment at time of death — `human_stuff`

One of the **kill flag** checks is the direction check: `front` or `back`.\
If an obstacle prevents the animation from playing, selection proceeds as follows:

1. Use the correct direction specified in the `human_kill_flags` parameter.
2. Swap the direction flags (`front` ↔ `back`).
3. Use a variant without direction flags — intended for cases where the soldier falls in place and collides with the obstacle.

The main animation assignment method is [random selection](https://docs.bestway.com.ua/animation/animation-system-for-actor/animation-selection-setup/pages/Ap4atTpYWVJYwkRJyI8L#id-2.-random-animation-selection) by weight from the specified animation list.

<details>

<summary>Example: death animation selection by kill flags (no direction)</summary>

```
{stand_dying
    ...
    {if human_kill_flags "cover_in_trench"
        {random_select
            {weight 1 "stand_die_trench_1"}
            {weight 1 "stand_die_trench_2"}
            {weight 1 "stand_die_trench_3"}
        }
    }
    [...]
}
```

</details>

<details>

<summary>Example: death animation selection with kill flags (<code>front</code>/<code>back</code>)</summary>

```
{squat_dying 
    {if human_kill_flags "front" 
        {if human_kill_flags "blast" 
            {random_select 
                {weight 1 "death_from_explosion_front"} 
                {weight 1 "death_from_explosion_front02"}
                {weight 0.5 "stand_die_back_5_blast"} 
                {weight 1 "stand_die-force_back_1"} 
                {weight 1 "stand_die-force_back_2_far"} 
                {weight 1 "stand_die-force_back_3_far"} 
            } 
        } 
        {random_select 
            {weight 1 "squat_die"} 
            {weight 1 "squat_die_back_1"} 
            {weight 1 "squat_die_back_2"} 
            {weight 1 "squat_die_force-back"} 
        }
    } 
    {if human_kill_flags "back" 
        {if human_kill_flags "blast" 
            {random_select 
                {weight 1 "death_from_explosion_back"} 
                {weight 1 "death_from_explosion_back02"} 
                {weight 0.5 "stand_die_front_1_blast"} 
                {weight 1 "stand_die-force_front_1"} 
                {weight 1 "stand_die-force_front_2"} 
                {weight 1 "stand_die-force_front_3_far"} 
                {weight 1 "stand_die-force_front_4_far"} 
            } 
        }
    }
    [...]
}
```

</details>

## Post-death behavior of the human actor

After death, the engine places the corpse on the surface.\
To ensure that the body remains in the same position after the death animation finishes (e.g., death in a trench), the animation settings use the property:

```c
{props "dont_update_placement_after_death"}
```

This property can be defined in `properties\animation\human\`**`human_anm.ext`**

or in any animation settings list.

<details>

<summary>Example: death animation configuration in <code>human.ext</code></summary>

```
{sequence "stand_die_trench_1" 
    {speed 0.9} 
    {props "dont_update_placement_after_death"} 
    [...]
}
{sequence "stand_die_trench_2" {speed 0.9} {props "dont_update_placement_after_death"} [...]}
{sequence "stand_die_trench_3" {speed 1.2} {props "dont_update_placement_after_death"} [...]}
```

</details>


---

# Agent Instructions: 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://docs.bestway.com.ua/animation/animation-system-for-actor/animation-selection-setup/human-death-animation-selection.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.
