Health attribute of units owned by the same player trying to match each other

Both Players and Campfires have a Health attribute by the same name
The Campfire’s Health attribute decreases so that it despawns over time
However, once you place a Campfire, your own health starts to try to mirror your Campfire’s, switching between the Campfire’s health and the health value you should actually have. The same happens if you place multiple campfires, with the player’s health value switching between the different health values of the units they own, eventually killing the player along with the campfire gif

1 Like

I think the issue is that you put the shown as [center bar] for the campfire. If you remove the center bar display the health will no longer flicker.

The reason your player dies with your campfire is in your attribute empties code. The player owns the campfire and when the campfire dies you check if player type of player1 == player. This means if any unit owned by a player dies you will create a new unit for the player. Instead you should check if the unit that died was a unit of type player. Alternatively you could make the campfire that is created be owned by the AI Resources.

OH i see! I had checked the attribute empties script but hadn’t noticed that because the player unit type is also called player. thank you so much!