Download

Problem adding values to GameInstance Variables in Tick

Hi,

So I’m having a problem with my statistics system. I want to update the values for armor/resistance and damage based on stats on item that I have equipped.

The problem I’m having is that when I have to update values from variables that come from MyGameInstance it keeps on adding the statistic over and over again each tick.

I’m doing the same code for health/health regeneration/mana/mana regeneration which are variables in the PlayerBase class itself. These values don’t keep on getting added, it just does that only once when the stats from the equipped items change. The only difference for these stats is that they come from Playerbase class, but not from MyGameInstance.

So calling MyGameInstance seems to trigger the tick function each time, while stats from PlayerBase class don’t.

So why is that happening and is there a solution to this problem?

Thanks in advance!

In the attached image, all the code is inside the tick function

So what’s happening is this: When I equip an item that has + Max Mana stat, the mana gets added (only once). When I equip an item that has + Armor stat, every tick it adds the armor, instead of doing it only once.