Using Damage Types on Damage Events in Blueprint

Hi,

I understand how to create new DamageTypes and use the variables stored within, however I’m not sure how Damage Types are intended to be classified/separated when they are received.

The most simple way I have found of figuring out what Damage Type I receive in a Damage Event is to use a Sequence and cast to each damage type I have in my game (or that my current Actor supports receiving).

This works, but it certainly does not strike me as being particularly elegant.

Is this the way it’s intended to be used, or is there a better way?

Thanks!

That doesn’t change the functionality though and personally I prefer the sequence for layout purposes.

I just wanted confirmation that this is the way Damage Types are intended to be used on the receiving end.

Thanks

HI JParent,

Instead of the sequence, I would run the additional casts in the cast failed output pin unless you plan on doing combinations of damage types. Otherwise, this is probably going to be the best solution for what you are trying to accomplish.

It does change it. Let’s say You have damage type fire and dragonFire that is child of it. If You use sequence You will be able to cast DragonFire to DragonFire and to Fire so You will apply damage type, that could lead to hard to find bug.

EDIT: In our project we have base DamageType class that have enum damage type. OnApplyDamage we cast to this base class and then use switch on DamageTypeEnum.

Here is How I solved this problem for myself. First I created a damage base class with the following function in it:

Then I process damage on the character, calling to the damage base class (returning it will return all damage types that child from it).

I hope this helps solve the question!