new to c++ and cant set each actor with a health component i made to have a different health value

Components added in c++ and stored under a UPROPERTY should always be marked VisibleAnywhere instead of EditAnywhere. EditAnywhere leads to blueprint corruption when dealing with components. At that point only recreating of a blueprint asset gets rid of odd problems.

All your properties are missing property initialisation in the example code you show. This leads to undefined behavior.

You are calling the “_Implementation” version of a function when you should be calling the non implementation version “TakeDamageEvent”.

You are looping. If owning character takes damage then call health component DamageTaken, then call OwningCharacter->TakeDamageEvent. It’s a loop?

I hope that the issue is solved once you fix the errors I see right now. Else, let me know and we can look at the updated code.

I’ve made a plugin a while back which can be used as a health component (or stamina, or literally anything else) which I placed online for sale. You can also get that for a working system and a good code example:

https://ferrefy.com/documentation/status-effects-plugin/

Ferrefy Plugin: Status Effects | Fab

1 Like