DamageType problem

I am trying to do something that seems very simple and straightforward: I have a Tool in my game that applies damage to an actor in the world. The tool specifies a DamageType in the ApplyDamage function, and the recipient actor receives the damage via the “Event AnyDamage” event. On my actor, I specify what type of damage affects it via a DamageType class reference variable. Then, I test to make sure the damage done is of the type that the actor should respond to.

The ApplyDamage function specifies DamageType via a class reference, but the AnyDamage Event on the actor outputs a DamageType object reference. I convert the object reference to a class reference with a GetClass function.

In this case, I have a DamageType called DAM_Axe. I only want my axe to damage things that specifically take axe damage.

But, if I test to see if those are the same DamageType, it always returns false. If I print the friendlyName of the DamageType class reference that is passed to the Actor, it always says it’s “Default_DAM_Hammer_C”, whereas the DamageType class reference on the Actor is “DAM_Axe_C”.

You can see a screenshot of the blueprint, which is extremlely simple. Am I testing DamageType the wrong way?


So your struct should have a default damage type. That’s likely why it keeps feeding out another value. The logic for the struct is sound and a great idea. You just need something to build a cusomt struct from for your axe damage.

1 - Make your Axe Damage Type - I assume You’ve done this already, just for the sake of being complete.
2 - Make your struct - Which you’ve already done
3 - Make a data table and lay i tout to match your struct - Add a row for each type of damage - so a row for Axe, a row for hammer etc
4 - Before Apply damage, you need a Get Data table row.
5 - The row will return a struct, which you can break as normal, only now it’s filled with your data, not default values.

This way, you can store everything’s damage information and everything else per the struct you’ve made. How you choose to pull it out is up to you, but essentially, you just need to tell your BP which row to point to.

I used it to randomly generate weapon names stats and damage types on their spawn. When the player picked them up, it would feed this struct into a player weapons slot struct in the character/controller and I could send the dtata that way :slight_smile: so that’s an alternative less headachey way to try :slight_smile:

for the way you’re implementing though, you will just need to tell your BP - If I have an axe, pull out the row for Axe. :slight_smile: I’m lazy, I didn’t replicate your struct but hopefully you get the gist. :slight_smile: