a few questions for projectiles and hit cause knockback effects in moba/rts/top down game

im new to unreal and need some help with these effects for my moba/brawler game where its a top down game and you cast abilitys that are projectiles like fire balls i guess and when you hit other charactors they are pushedback/knocked back. iv been looking everywhere to find out how to do these but have come up short. so here i am

as far as i know to have physics on your character that is controlled by ai its basicly impossible and since this is a click and ai moves to the clicked location i cant use impulses/forces for my knockbacks.

the only way i can think of to get the knockback/sliding effect when hit is have a system that loops 0.2 second with a array and sets the actors location and adds a offset with each loop simulating its being knocked back and adding actor to the array with the variables required when hit to handle multiple hits for multiple charctors.
so then it would be somthing like:
charactor hit > get angle hit from > set hit charactors location to current location + 10 @ the angle > set distence = distence+ 10 > if distance = 500 remove charactor from array>if array empty turn off loop

since i cant turn physics on my characters i beleive ill have to use overlaps and not on hit events meaning ill have to use Tracers to get the angle it was hit from?

unless there is some other movment i can easily use for this kind of knockback effect id like to hear about it and if i need to add a knockback/slide system like this would it just be its own blueprint?

im still fairly new to unreal and blueprints and im not sure how casting to all the children of a parent would work e.g
i have a parent i base all my characters off it. projectile hits > is the thing it hit any of my charactors…cast to the parent class? or will i need a loop for all the children? the children being each character

also what can i do to make projectiles follow the hight of the landscape e.g it gets shot towards a ramp but instead of crashing into the ramp/slop it goes up the ramp/slop. lets say projectiles are always 100units off the ground. but if it is a actual cliff(for cliffs ill probably just use collision boxes) or pillar destroy it i dont want it jumping over them

You can add impulses to the char movement component:

The physics simulation is not running here but the character comp can handle it internally. Do note that characters that are on the ground have a loooot of friction (as per their respective component’s settings).

If you add a bit of Z or hit a character that is not affected by friction (already in the air?), that 5k will send them off much, much further. This may be irrelevant if the characters never leave the ground, ofc.

Or you can modify their friction when they get hit. Disable the movement logic when they get hit, add a small delay after the impulse and tell them where to go again.

2 Likes

No looping necessary. If this is your parent class:

Any hit child will execute it.

What’s more, a child can either override it to do their own thing, ignoring the parent’s class implementation:

image

Or respect what the parent is generally doing and add their own stuff:

This dude takes only 10% of damage, which in this case is interpreted as not being pushed far when hit.

1 Like

Dam didnt know that was possible. thanks so much makes it so much easyer. yeah my characters are never really off the ground and i aslo found that changing the ground friction to 0 had no changes. also messed with adding Z before the impulse didnt seem to change the distance guess ill just have to stick to using big numbers.


so i can call event point damage on projectile collisions ? guess ill have to do some reasearch on Event Point Damage havent seen that function

also i really appreciate the extra effort with the pictures thanks

The damage system is pretty handy because it does 99% of what is generally needed in most cases. There’s damage, point damage (more data) and radial falloff damage (orwhatshername).

Alternatively, you can create your own data interface to streamline it. You already started, I see.

There are options how to handle things, too:

  • when projectile hits, apply damage to hit actors - this is done inside the projectile. Target actors receive just damage.
  • when projectile hits, it triggers onHit/Overlap event in the target actor who can than apply the damage to itself based on that hit info

The first option is usually more straightforward.

The native system also uses a separate damage class which adds a lot of granularity and flexibility.

Regarding Z - the movement comp keeps characters glued to the ground, it takes quite an impulse to send them flying. Tick the Velocity Change on the node to ignore mass. We’re talking about orders of magnitude in force applied.