Hitscan AoE damage

Hey hey people,

TL;DR : We have a hitscan system to deal damage to enemies. We’re trying to make a turret deal splash damage. We can’t. I hope we can.

We’re in trouble once again… I put some days trying to figure this one by myself… But we can’t. And we have some pretty darn deadlines before us. So… Here we are.

This is our function. It is stored in an actor which has children. The actor is a turret and every child is a type of turret with different abilities. It works pretty fine atm.
And as youc an see, the way of dealing damage to our enemies are pretty simple…

SetTimerByFunctionName

In the event graph of the parent of all our other turrets, we basically do something like : “If you’re an enemy and overlap a collision sphere, you get shot instantly”. Like in good ol’ Doom for example. (Must have been just if you’re on screen and a a certain distance back then, but you get the idea)

ForLoop

This is in the function “Attack Enemy”. The idea here is to have a Collision Sphere stored in the Parent Turret. Each time it scans and damage an enemy, the Collision Sphere is moved to the enemy it just hits. Then, every enemy overlaping this sphere is going to take damage… But We can’t get the last part… “All the enemies overlaping this sphere”.

Another thing we tried was to create a projectile that would be destroyed once it hits an enemy. THEN, draw a sphere and any enemy overlaping that sphere would be destroyed. It works perfectly… BUT… We can’t get a reference to the function of another actor…
To help you understand : Parent_Turret > Children_Turret > Projectile.
It’s pretty difficult to make references from the projectile to the Parent_Turret since the projectile is not a children nor stored in the Parent blueprint. And we can’t figure how to get a function from them either.

I hope it makes sense. If it does not, don’t hesitate, I would try to be clearer.

Thank you.

Is there a reason why you’re not using these:

As in:

This is the enemy:

And we’re dealing splash damage:

Perhaps there’s no need for those arrays and loops.

And you can, of course, leverage the other features, too - like the damage type classes, for example. You’ve got pins for damage causer to get the pertinent references and so on.

Either that, or create your own Interface calls with all the bells and whistles but the native damage system can take you quite far, actually.

That’s what dispatcher callbacks are for:

Imagine the above is in the turret, when the projectiles it spawned hit something, the turret will know pretty much all there is to know about the result.

Hello @Everynone
It’s so simple and yet so effective. I guess that’s what you get when you want to make things quick and do not look what the engine has already in.

It works perfectly fine now. Thanks :slight_smile:

1 Like