> For the complete documentation index, see [llms.txt](https://hitmans-store.gitbook.io/pras-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hitmans-store.gitbook.io/pras-documentation/tutorial/getting-set-up/character-setup.md).

# Character Setup

{% hint style="success" %}
**Tip:** all the functionality below is available to both Blueprints and C++.
{% endhint %}

## Step 1 - Add the RecoilAnimation component

First off, you need to add the recoil component to your character. You can do it in both **Blueprints** and **C++**:

{% tabs %}
{% tab title="Blueprints" %}

<figure><img src="/files/V93SYBXsBK5KPd1lTMsw" alt="" width="419"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}
{% code title="YourCharacterClass.h" %}

```cpp
UCLASS(config=Game)
class AYourCharacterClass : public ACharacter
{
    GENERATED_BODY()

public:
    AYourCharacterClass();

protected:
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Recoil")
    TObjectPtr<URecoilAnimationComponent> RecoilComponent;

    ...
};
```

{% endcode %}

{% code title="YourCharacterClass.cpp" overflow="wrap" %}

```cpp
AYourCharacterClass::AYourCharacterClass()
{
    ...
    RecoilComponent = CreateDefaultSubobject<URecoilAnimationComponent>(TEXT("RecoilComponent"));
    ...
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

Then, in your character class click on the RecoilAnimation component and specify the Helper UI:

<figure><img src="/files/TuDOCXta6mDw9ujmRUyo" alt="" width="384"><figcaption><p>Select this Blueprint asset</p></figcaption></figure>

The Helper UI is useful when you want to modify the recoil values in runtime in a very convenient way:

<figure><img src="/files/hfyHofvqSVU8OIr7nHCG" alt="" width="355"><figcaption></figcaption></figure>

To enable this Helper UI in the game you can use the Blueprint-exposed methods:

<figure><img src="/files/amSSvvLsXYtNWYt8ixMk" alt="" width="485"><figcaption><p>Example from the demo project</p></figcaption></figure>

## Step 2 - Integration

Now it's time to call PRAS-related functions. Here're the events PRAS needs to generate top-notch recoil:

### Init

This method must be called when a new weapon is equipped. You need to pass the crucial information from your weapon to the RecoilAnimation component:

<figure><img src="/files/ZtTBYQjKzJP8KcfAo3XU" alt="" width="489"><figcaption><p>Example from the demo</p></figcaption></figure>

**Data** - *Recoil AnimatioData* struct, that contains curves and a Recoil Data Asset:

<figure><img src="/files/T7kxPBSmKPdYsNGE1bmS" alt="" width="370"><figcaption><p>Make sure to assign the curves, slot name and a Stored Data asset!</p></figcaption></figure>

### Play/Stop

Call these methods when firing and stop firing respectively.

{% hint style="danger" %}
**Tip:** Play must be called when every shot is fired, it's required for the auto and burst fire modes to work properly.
{% endhint %}

<figure><img src="/files/RWz4tMHRuh9RunKGfP2Y" alt="" width="487"><figcaption><p>Note: Event On Fire Pressed is called every shot!</p></figcaption></figure>

### Set Fire Mode

Call this method when a fire mode is updated:

<figure><img src="/files/WegJXmmL6G4szs5J3iN8" alt="" width="497"><figcaption></figcaption></figure>

### Set Aiming Status

When a player aiming state is updated, make sure to call this method to affect the recoil during ADS:

<figure><img src="/files/dU8wLELwIKlKIem92IkU" alt="" width="468"><figcaption></figcaption></figure>

## Step 3 - Add data to the Weapon

The final step is to add the Recoil Anim Data struct to your weapon:

{% tabs %}
{% tab title="Blueprints" %}

<figure><img src="/files/vQpdAbNbSSB1OV7SjVxC" alt="" width="368"><figcaption><p>Add this property to your base weapon class</p></figcaption></figure>
{% endtab %}

{% tab title="C++" %}
{% code title="Weapon.h" overflow="wrap" %}

```cpp
UCLASS(BlueprintType)
class PRAS_DEMOPROJECT_API AWeapon : public AActor
{
    GENERATED_BODY()
	
    AWeapon();

public:
    // Add a new property to your class
    UPROPERTY(EditDefaultsOnly, Category = "Animation")
    FRecoilAnimData RecoilAnimData;
    ...
};
```

{% endcode %}
{% endtab %}
{% endtabs %}

Populate this struct with Curves and Recoil Data Assets in your weapon blueprints. You can get the example assets in[Getting Set Up](/pras-documentation/tutorial/getting-set-up.md#step-1-installing-the-plugin).

Example:

<figure><img src="/files/i2R3OyfbeRJ7w4DlZjEI" alt="" width="381"><figcaption></figcaption></figure>
