> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinemation.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 📘Weapon Blueprint

> In this page we will cover how weapons work.

## Overview

Every weapon consists of two important parts:

1. **Weapon Settings** data asset: contains data (e.g. animations, weapon mesh).

2. **Weapon Base** blueprint: executes gameplay logic (e.g. firing, reloading).

Here is how the weapon spawning logic works:

1. Iterate over the TArray of **Weapon Settings** provided by the **Character Settings**.

2. Instatiate a **Weapon Blueprint** specified in the **Weapon Settings**.

3. Update the **Weapon Settings** variable of the newly instantiated weapon.

<Tip>
  **Note**: weapon blueprints don't contain weapon models. Instead, *WeaponMesh* from *BP\_Viewmodel* is updated with the active weapon **SkeletalMesh**.
</Tip>

## Weapon Settings

This data asset consists of 2 major categories:

* **Animation**: properties related to the character and weapon animation.

* **Gameplay**: properties related to the weapon features (e.g. fire rate, ammo, etc.).

<Frame caption={"Animation group."}>
  <img src="https://mintcdn.com/kinemation/PlmzVQHJ3J_C1x92/images/fps-animation-pack/unreal/319d1f8a303559d24cf5.png?fit=max&auto=format&n=PlmzVQHJ3J_C1x92&q=85&s=1d06baf68be301fb63b5ace605b076e1" alt="" width={443} data-path="images/fps-animation-pack/unreal/319d1f8a303559d24cf5.png" />
</Frame>

1. **UE4** and **UE5** represent [Viewmodel Settings](/fps-animation-pack/unreal/gameplay/types#viewmodel-settings) for different Mannequin meshes.

2. **Weapon Anims**: weapon animations [Viewmodel Animations](/fps-animation-pack/unreal/gameplay/types#viewmodel-animations).

3. **Weapon Mesh**: *Skeletal Mesh* of this weapon.

4. **Weapon Anim Instance**: weapon animation blueprint.

5. **Ads Blend**: blend between absolute and additive aiming.

6. **Recoil Settings**: [recoil animation settings](/pras/basics/recoil-settings).

7. **Sprint Trigger Discipline**: whether to use trigger safety when sprinting.

8. **Fire Trigger Weight**: weight of the finger rotation when firing.

Now let's break down the **Gameplay** category:

<Frame caption={"Gameplay properties."}>
  <img src="https://mintcdn.com/kinemation/PlmzVQHJ3J_C1x92/images/fps-animation-pack/unreal/2d001aa650a3b7f145a9.png?fit=max&auto=format&n=PlmzVQHJ3J_C1x92&q=85&s=f9e250d67cea3bf6cde3814277d0d473" alt="" width={434} data-path="images/fps-animation-pack/unreal/2d001aa650a3b7f145a9.png" />
</Frame>

1. **Ammo**: ammo capacity of this weapon.

2. **Ammo Refil Time Scale**: ammo will be refilled when the reload ends, but this time can be adjusted with this multiplier.

3. **Fire Mode**: supported fire modes.

4. **Fire Rate**: fire rate in rounds per minute.

5. **Weapon Class**: Weapon Base blueprint class.

6. **Recoil Shake**: camera shake asset.

7. **Fire Sound**: this sound cue will be played when firing.

Now let's learn more about the weapon blueprints.

## Weapon Blueprint

Weapons must have a runtime entity to run its logic like reloads or firing. This logic is implemented in blueprints derived from the **Weapon Base** class:

<Frame caption={"The plugin uses 4 main weapon types."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/ab6ee8ae411fa572f78e.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=4c24a4c09bd1c3b813794cda22c9daaf" alt="" width={496} data-path="images/fps-animation-pack/unreal/ab6ee8ae411fa572f78e.png" />
</Frame>

These blueprints use different implementations for reloading animations, other gameplay features are the same.

### Equipping

When a weapon is equipped, it binds its functions to the **BP\_Viewmodel** Dispatchers. So, when an input is triggered, a weapon function will be invoked:

<Frame caption={"Reloading function binding."}>
  <img src="https://mintcdn.com/kinemation/6K2VhvCCGB3AmUKf/images/fps-animation-pack/unreal/fbedb5b59e7bb1643275.png?fit=max&auto=format&n=6K2VhvCCGB3AmUKf&q=85&s=bbcc922331f45f85d85944fc69f77085" alt="" width={500} data-path="images/fps-animation-pack/unreal/fbedb5b59e7bb1643275.png" />
</Frame>

<Warning>
  **Note**: it is important to clear bindings when a weapon is unequipped to prevent functions getting invoked on unequipped guns.
</Warning>

### Reloading

When a reloading function is called, the Weapon Base will play a reloading animation based on the left ammunition:

1. If there is no ammo, an empty reload will be played.

2. If there is some ammo left, a tactical reload will be played.

Some weapons have exceptions, however. For example, manually reloaded **KXG12** and **Kar98k** follow this algorithm\*\*:\*\*

1. Play reload start animation.

2. Play reload loop based on how many cartridges need to be inserted.

3. Play reload stop to finalize the reload.

**MGX5** is a machine gun, it has 3 reloading animations:

1. Empty reload.

2. Tactical reload.

3. Less reload, when we have some guntape cartridges left.

All other weapons use general reloading logic.

***

Now that we are familiar with the gameplay logic, it is time to understand how animations work in the project.
