Question about the reusability of the HealthComponent

Hi there,

so after adding the HealthComponent to BP_PawnTank and BP_PawnTurret blueprints I was playing around with setting default MaxHealth values of each individually. Basically I wanted to give the tank more Health than the tower.
But I can’t set them individually, since as soon as the MaxHealth value in one of the HealthComponents is changed, it’s changed in the other blueprints HealthComponent as well.

  1. Did I miss something here from the lecture? Just rewatched it and if so, I missed it again.^^

  2. After that I tried to inherit BP_HealthComponent for the Tank on another one for the Tower and add them respectivly so that I can set MaxHealth individually but this also doesn’t work since UE tells me: “Cannot create a new Blueprint class based on HelathComponent.”

  3. If 1. and 2. are true which would be the way to give both BPs (Tank and Tower) individual MaxHealth. Inheriting from the C++ HealthComponent and add those childs instead? Or do I missunderstand the reusability of Components here?

That sounds like a bug honestly. Could you try re-creating the tank/tower blueprint?

@DanM Thanks for the tip, I started with removing and adding the HealthComponent to both BP’s again, which resoled this problem and the MaxHealth vakue can be set individually as expected.

I could also kind of recreate this undesired behavior: During UE compiling C++ code I edited the HealthComponent MaxHealth values real quick, after the compiling finished the HealthComponent values were resetted to their initial values and also coupled as described above.

I faced some bugs like that, for example, removed the missile in the blueprint to check the “if” with null pointer and the tank was still shooting missiles. Problems related to C++ and blueprints acting weird usually get fixed closing UE editor and opening it, blueprints created from C++ sometimes act weird if C++ code changes after the blueprint was created without restarting the editor after the changes.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms