Equipment / Equipment Stats

If you want to get the calculated sum of all numeric dynamic data currently equipped by the player you can call the getEquippedStats function on the AC_Inventory_Equipment component.

From inside our pawn we can do this to get the total amount of damage on all equipped items:

From anywhere else we can get the player's pawn equipment system component like this:

For single player you can do this from anywhere. For multiplayer you need a valid reference to the right player's player controller if calling this from the server.

On this getEquippedStats function you can optionally provide a string through ignoreIfZero, which will ignore stats on the item if this key exists, and the current value is 0. This is handy if you set up something like durability, where if it is 0 (and broken) you don’t want it to count the stats (like armor).

A note about Remote Equipment

It is important to know that any equipment that is being overridden remotely will not be counted when this function is called, since the stats on the equipment overriding the slot will be used instead. For example if you have an equipment slot in the window for a main hand weapon and you are also allowing main hand weapons to equip through the hotbar, if you have a weapon with 10 damage in the window, and select a weapon on the hotbar with 25 damage, only the 25 will be included in the sum. Then when you unselect that slot on the hotbar the 10 from the window will be used.

If you want it to count both you will need to remove the part of the code inside this function that is finding and setting the exclude slot.

A similar function for storage components

If you want to get stats about items in the player inventory or a storage container you can use a similar function getSumData is also available on the AC_Inventory_Storage component.

The key difference between getSumData and getEquippedStats is that the getEquippedStats function is set up to also include any remote equipment that is currently equipped through the hotbar, while also ignoring any equipment this remote hotbar slot is overriding.