Download

Taking damage from one actor (sword)

Hey Guys,

Im doing some fine tuning to my combat system and was wondering if it is possible to create an event where it only kicks off when a sword has overlapped the NPC. So far all I have is an event that detects when anything overlaps it and not just the sword (as seen below). If there is another way of doing this I would greatly appreciate the help.

The overlapped component and other component nodes probably hold the value you need.

The theory is you check that the actor class is correct for what you need, and based on the result apply the needed damage node.

Obviously though, if your sword is an actor you can also go the other way around.
in the sword BP create similar detection nodes and only activate the damage with the same code pictured above… except switch the pin to overlapped component, since you need the sword to apply damage whe overlapping the actor.

Looking at your Blueprint it seems that you are really close. Since you are casting to Fractor_Soldier you need to drag a line to the damaged actor node from as Fractor_Soldier. I assume that Actor is taking damage. I assume you are using a sword and that is the component you are overlapping?

So I followed both MostHost LA and WildeDev, however every time I try to cast to my sword class it fails. Can one of you show an example. Heres how its setup now.

Well, unless the object generating the code is the sword you cannot cast to it.
so if this code is on factor_soldier that’s why that cast works.
Drag off from get class, type child and get the is child of class node.
It returns a bool so you can plug direct in a branch and hook up the different damage node to the true.

I really don’t understand why I needs a branch and boolean in this situation

Ok so it seems like you are casting from your player’s sword capsule to the enemy. You might want to change the Damage causer pin and add “Get player Character” node there.

Hey guys finally found the answer (as seen bellow). Thanks for steering me in the correct location.