Apply damage to hit actor

Hey,

im currently confused when it comes to apply damage to the actor my projectile hit.

I know how to apply it to one enemy type, but if i will have multiple ones, i dont know how i would cast to the one my projectile hit.

Im not making it to complex, means the only difference will be the health the enemys have.

As you see im casting to the hit actor directly, but since i will have more then just 1 type of this class.

So how would i need to do in this case :S ?

9c25e556d17108af1ab8113853a7a39e33dfe818.jpeg

c99173496bcc5af4b1c8f2b2dc1a4a3d828aa686.jpeg

The way I did it is by creating one parent blueprint that holds all of the damage programming, and then creating children blueprints off of the parent. This way, they all inherit the damage function and you can “Cast To” the parent BP. As long as the attack is hitting a child of the parent, it will still be effected.

You could have a base class that has all the basic logic for taking damage, and all the other “enemy types” are children of this class.

Or, and I would recommend this, you utilize interfaces.

A third option is to use the built in damage system.
Sadly there is little documentation about it, but it’s actually pretty straight forward.

https://www.unrealengine.com/blog/damage-in-ue4https://youtube.com/watch?v=8RuMckVAA4chttps://www.youtube.com/watch?v=MLtDgukVG94

Well, that apply damage ( built in one ) is currently the best option for me at the moment. I tried it once but now i actually know how to use it.
So thank you both for the replys !! have a nice one