My game has a couple new qualities to pass along with damage dealt to pawns. All my pawns will have a brief moment of being invincible after they are hurt, which I might at some point set to be alterable so different attacks can induce different periods of invincibility. I further need an ability to add a specific "Knock-Back" effect to the player which will induce specific animations and other effects.
I was starting to set this up by simply extending the TakeDamage function within my pawn class. It would add a new optional parameter and call the super.TakeDamage with the default parameters. However when I tried to compile this test I discovered that it would not allow me to redefine the function with a different number of parameters.
So I need a new plan of attack.
I need a way for attacks to add a new variable I can use in the damage code, possibly two.
I'm mulling this over but I don't have anything that really seems like a good idea to me, so I am turning to the forum here to ask if anyone has a good idea about how I should handle this.
In addition to subclassing UTDamageType, you can also make a new YourGameTakeDamage() function that will be called by your weapon and other damage dealers. From there, you could call the regular TakeDamage function to get the functionality there as well as have some custom code in addition to that or you can just code your own damage dealing functionality. Hope that gives you a few ideas.
Hmm, but if I created a new damage-type I would need a huge switch list to check all my new damage types, or else drop out any conventional use of damage type.
I like the idea to create a new take damage function. I could call the super.takeDamage from there, and have a new take damage in my class that calls my custom take damage after assigning default values to my new variables. That way I could cover all my bases.