Announcement

Collapse
No announcement yet.

Apply damage to hit actor

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 ?

    Click image for larger version

Name:	1.png
Views:	2
Size:	344.4 KB
ID:	1209668


    Click image for larger version

Name:	2.png
Views:	2
Size:	550.5 KB
ID:	1209669

  • #2
    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.

    Comment


    • #3
      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.
      https://docs.unrealengine.com/latest...ace/index.html
      https://docs.unrealengine.com/latest...ces/index.html

      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://docs.unrealengine.com/latest...age/index.html
      https://www.unrealengine.com/blog/damage-in-ue4
      https://www.youtube.com/watch?v=8RuMckVAA4c
      https://www.youtube.com/watch?v=MLtDgukVG94

      Comment


      • #4
        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

        Comment

        Working...
        X