Download

Shotgun projectiles as one for floating damage text

Hello guys.

I have weapon damage system based on weapon projectiles. And i have a floating damage text system.

The problem is when i shout with shotgun and 2 or more projectiles hit the actor i get 2 or more times the floating text with the same number… Thats beacuse the damage on every projectile has the math (base damage/5) . The shotgun shouts 5 projectiles every time thats why the 5 on my math.

Can i have all shotgun projectiles that hit the actor and get one number for damage to appear on floating damage system?

anyone can help?

You’ll need to track the life of each projectile and tally damage once all are dead (destroyed).

A simple way to track is to increment an int var (projectiles Live) when you spawn a shotgun projectile.

As each projectile hits or lifespan expires it’s destroyed. You can use Event Destroyed to subtract 1 from the int (projectiles Live). Calc the damage and add it to a “tallyDmg” var.
Once “projectiles Live” is 0 apply dmg as a whole (tallydmg). Tally damage (floating dmg value) … health - tally dmg = player health.

https://docs.unrealengine.com/en-US/…yed/index.html

depending on the lifespan of your projectiles there could be delays in some scenarios with the dmg application and floating text display.