Unreal Engine comes with the fine tool called DamateType, which is passed by ApplyDamage (and TakeDamage), so we can calculate character resistance for this kind of damage and deal with it.
But I can’t get an idea about dealing with several damage types. For example, sword with Slash damage type become enhanced with the Poison damage type - so my sword must apply both damage types, Slash and Poison. But Unreal Engine can accept only one damage type for taking damage event (for example AnyDamage).
Did anyone experienced that? How Epic are managing it in Fortnite? Weapons inside that game can have several damage types too.
The way I have done it in the past is by having two enums in my weapon. One for damage type and the other for element type. That way, my all of my weapons have can be made off of one parent BP and just pass along the enums with the damage amounts to whatever is being attacked.
Could call apply damage once for each damage type, or create a class to represent each damage ‘type’ that is held in array of a real DamageType.
Yeah, right now I’m working on these kind of solution. But maybe someone or Epic gyus know the better solution for that?
Because I think at Unreal Engine by design they pass the single Damage Type for some reason, I just need to know that reason
Sorry if a bump up this old question but this it is something I’m really interested in. Is anyone handling multiple damage types using a single damage type class or the only (and most correct) way to handle this case is applying damage multiple times (one for each damage type)?
I made blueprintable components. One was Pain_Dealer second Pain_receptor. Added blueprint interface to both.
When bullet (or projectile or hitscan) weapon hit target it checked if target has PainReceptor. Then information about damage types was sent over as array of struct (damage type enum and amount).
I think while default damage system from epic is robust, I need more control over how that all works.
Next upgrade for that system was adding Yet another blueprintable component to static meshes that were meant to be destructible (had set tag “I_am_destructible”), this way only meshes that player shoot and could be damaged (by level design were) damageable.
If you set everything to work with multiple damage types to be sent over you can always send array of single damage type, just more flexible setup.
I’d like opinions on my idea;
each unit has an array of damage multipliers a base damage & armour type enum. Upon recieving damage I interface the damage causer for the array & get the multiplier corresponding to the armour type of the unit receiving damage.
Also received in the interface is a damage type enum of which the unit receiving damage will use to get a multiplier from its armour multipliers.
As a poor analogy; each unit has a multiplier per material it may hit & each material a multiplier for each type of hit.
I think this could allow for better adjustments overall with only 2 enums 2 arrays & an interface.