How to create elemental magic type and weaknesses?

Firstly, have a look at how the damage system works in UE4:

Once you get the basics working, you can start looking into Damage Type: