1. Home
  2. Docs
  3. Starter Guides
  4. Damage Resource and Stat System
  5. Bind Custom Values

Bind Custom Values

This section describes how to add a new value the DRS system.

Im using the project created in the “Integration in new project” section for this guide.

Step 1 - Enumeration Entry

Create a new entry in E_ModifiableValues that describes your value/stat.
Im adding the stat “AttackSpeed” here.

Step 2 - Expand Inventory

Add the function “GetEquipmentAttackSpeed”  to the C_Inventory_Base and add a float return value.

Override the function in the C_Inventory component and create a new replicated value for it.

Add the variable in the “UpdateEquipmentValue” function

Step 3 - Character

Go into the BP_DRS_BaseCharacter and change the access Specifier from the function “RecalculateValue” to Protected

In the player character add two float variables
⇒ AttackSpeed and BaseAttackSpeed.

Set AttackSpeed to Replicated

Add a function that returns the base attack speed and in case of using an inventory, add the equipment value to it.
The function will return only the base attack speed when the inventory is invalid.

Override the “RecalculateValue” from the parent class and add a recalulation.

You can use the function “Recalculate ValueByReference”. The result of the calculation will be stored in the referenced float variable.

Optional - Recalculate Manually

Here is an exaple of the calculation without the  “RecalculateValueByReference” function.

I would do it with this function if you need to clamp the value, e.g. maxWalkSpeed cannot fall below 0

Step 4 - Use your variable

You can now use the variable “AttackSpeed” in you functions.
It will be updated when equipment changes in case you have an inventory or a modifier is changed (Gameplay effects).

How can we help?