Hi guys,
I’m trying to set UDamageType based on an what the designer picked in the editor (Out of a dropdown menu which is basically an Enum).
- Designer picks spell type: AOE, Projectile, etc. (Which is an ENUM under the hood)
-
If its AOE, my FDamageEvent gets downcasted to FRadialDamage , else it remains FDamageEvent
-
Designer picks elemental type such as fire or frost
-
If Fire my UDamageType elementType, gets assigned to UDamageTypes_Fire::StaticClass()
-
Player casts a spell, it collides with enemyPlayer
-
I call enemyPlayer.TakeDamage() with the spells new values: FRadialDamageEvent and UDamageTypes_Fire (AOE Fire)
I have a UEANSWERHUB here with screenshots: https://answers.unrealengine.com/questions/213226/assigning-udamagetype-and-fdamageevent-dynamically.html
Mind you I can simply do this check when the spell collides with the enemy player, then cast it to lets say fire dmg. The problem with this is that I would have to recalculate the type every time the spell hit a player; whereas if I initialize it during instantiation then I would only need to do it once.