Results 1 to 5 of 5

Thread: New damage solution

  1. #1

    New damage solution

    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.

  2. #2
    You can subclass DamageType. Take a look at UTDamageType and its subclasses for ideas.

  3. #3
    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.

  4. #4
    You can call the new implementation from takedamge just rename your function n call thru

  5. #5
    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.

    Thank you!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts