UE4 Health system Blueprint interface system messing up

Yes, you can. I just provided you with an example of inheritance above. I don’t actually know how to even properly respond to that. Why not? What do you even mean by that? Inheritance is at the very core of OOP. You can’t really get far without it. If you’re casting, you’re already using inheritance…

Obviously, a weapon should not inherit from a character because that’d make little sense - both inherit from Actor, naturally. And that’s precisely why you’d use an interface. Connect 2 (or more) classes that share nothing, and with no casting to boot!

And if you could, when using inheritance, the need to use interfaces is completely meaningless,

No. Just no. What is making you say that? If you have 2 unrelated classes (character & weapon, and their respective children) that know nothing about one another, you can connect them with an Interface. Now any child of Character can talk to any child of Weapon. Same for for both base classes.

since you only need to cast the parent actor of both

If you cast to the parent, you cannot talk to the child… so, no, you’re incorrect.


To me it all sounds a bit as you’ve been avoiding interfaces and relying on other, less efficient and more convoluted means of communication and now that your mind is set, there’s no going back.

In the end, I’m not here to convince anybody but to clarify. Yes, interfaces make perfect sense and if you want a character to talk to a weapon, it’s pretty good case scenario. Effortless and no casting is required.


@ DanielG1939 Apologies for hijacking your thread.

I haven’t really used interfaces much so I can’t comment on that but…
I just built a system like this today using a master “Stat System” component that i can tack on to any player or NPC. Then there is a “Buff” component with corresponding values and an apply buff function that takes a Stat System as an input and then copies itself as a child of whatever owns that stat system so i have a history of all the buffs applied to that character. I add the Buff component to a master “Pickup” actor class that calls the apply buff function on overlap and deletes itself. Works for health packs, attack or defense stats, or any combination of any stat within the Stat System. The stat system itself calls a “die” function in the corresponding default player class or NPC class i’ve created and handles application of damage internally.

Update: started implementing interfaces and they are indeed useful. Use an interface call to get the “Stat System” component from either a NPC or player without casting and it significantly reduced the number of nodes i need for my weapons damage state system. Gonna get around to implementing interface calls into my custom team sense service too. Gotta say, interfaces + components is a powerful combo.

1 Like