Is there any way to change the variables held inside a Damage Type class at runtime during the Apply Damage event or are they static? I was hoping to use one Damage Type Class containing a map of the various types of damage (fire, ice, etc.) to allow for multiple damage types on the same attack and modify this at runtime through the actor causing the damage, is this possible or will I need to create my own Damage event?
That’s the whole point of using damage type:
Create your own damage type:
Define any behaviour you need:
And then you can use it with the damage system. Also, do consider spending 10 minutes with this short tut in case you’re unfamiliar with Interfaces:
They make the whole system work smoothly.
Sorry for necroposting @Everynone, and thanks for the video (and all your other precious answers!)
Do you know if there’s a way to pass a parameter during “apply damage” itself without creating too many damage type classes?
For example imagine that I want to apply water damage, but I also need to pass whether it’s physical or not to use different stats during the damage calculation.
Is it possible without overriding the ApplyDamage function in the actor class or without creating a duplicate datatype (DT_Water_Physical, DT_Water_Special)
Thank you in advance!
Hi there,
I haven’t tested it myself, but before applying damage, perhaps you want to get your damage class with custom variables, create object from class, modify variables values based on current ability, then get class and connect it to apply damage. On the other side, event any damage, get damage class, create object from class and get your custom variables to proceed with the rest of your damage calculation workflow.
Again, not sure if that works. Perhaps the solution with interface communication from the previous post should do the trick much easier.
You may want to try creating a data table for every damage type with all parameters associated based off a struct variable. On the target side, event any damage, get damage type and read a data table to extract queried variables.
Thanks for the answer, I’ve already tried to expose the variables on spawn and do what you said but ApplyDamage has a pure class input (purple node) and I wasn’t able to pass the created object.
Maybe there’s a different way to do it, I’ll try to dig deeper
Got it. I’ll see if I find something and share it here.
Good luck.
thought i’d share this since i was referencing this thread while looking into a similar idea.
if you open the damage type parent class in visual studio it has this note:
/**
- A DamageType is intended to define and describe a particular form of damage and to provide an avenue
- for customizing responses to damage from various sources.
- For example, a game could make a DamageType_Fire set it up to ignite the damaged actor.
- DamageTypes are never instanced and should be treated as immutable data holders with static code
- functionality. They should never be stateful.
*/
therefore, i will create as many individual damage types as I need and use a Map variable in the function that processes that incoming damage.
maybe that helps