How do I use my custom DamageType blueprint?

I’ve made a BP using DamageType as the parent class. I need the damage event to receive more information for the DamagedActor than just the 1 float (specifically 3 floats, in future iterations I may need to send more info). After digging through the answer hub, U4 documentation, Google and YouTube I haven’t been able to find any info or tutorials on how custom DamageTypes are supposed to be used. I’ve also tried casting and overriding functions to no avail.

If anyone is able to explain how to do this correctly it would be much appreciated.

Hi Nazgual,

These functions are your friend in this case. You supply the function with your custom DamageType class, and you’re set. When you get Event Receive Damage and its recieving damage. You simply cast the DamageType it returns to your custom one, and you should be able to access your custom variables.

Hi SilentX,

I’m going to need some clarification, so first I’ll further clarify what I need this to do. My prototype is based around melee combat, so the damage, stun and poise (my extra two floats) will have different values for each attack type. I have created two new floats in the DamageTypeBP, made them public and have made a function called ApplyDamageCustomBP.

When my player character successfully hits an enemy I can currently get the default ApplyDamage function to work fine and I can access the two floats from that BP from the enemy character when the AnyDamage event triggers.

However I have not been able to figure out how to use this custom damage function, various attempts to cast it failed. I also couldn’t work around this by setting the values of those two floats in the custom damage BP and getting them when the AnyDamage event triggered.


I see the problem. What I can suggest for now is using Events. So if you create an Attack Damage event similar to as I’ve shown here with your own Custom Variables. You can then set your Target as the Damaged Actor. Then the Damaged Actor will receive the hit and you can deal with it appropriately. Once you get your game online, you can replicate the Event as well.

25011-damageevent.png

Hi Nazgual,

Did anything work out for you?

-Peter

Hi Nazgul,

Understandable! Happy New Year!

Hmm, that’s a pretty clever workaround. Grats on figuring that out! I’ll have to take note of that.

Peter

Hi SilentX,

Sorry for the lack of response, I have been busy (holidays and whatnot) but I have found a solution.

I tried using events like you suggested, which did do what I needed but it also had the problem of all duplicates of that enemy type would take damage when only one of them got hit.

Instead I decided to create a new BP which has all of the data for each attack in a Vector array. When an enemy is hit they receive the standard damage event and use that float converted to an integer for a position in the array. The enemy can then use that Vector to get the 3 floats of data it needs to figure out all of the damage.

Happy New Year to you as well.

Thanks, I do want to return to this workaround later and replace it with better code but for now it does what I need it to.