Welcome back.
Since our section is called Combat Tricks and we're adding more features for combat.
One of the features that I'd like to see implemented in this game is a death impulse.
Now, what do I mean by death impulse?
Well, as soon as I launch a fireball at something, if that fireball was fatal, I'd like to add an
impulse on the character.
Now we're implementing a ragdoll system where when the character dies, it ragdolls.
Right?
We can see that by killing the creature.
And as soon as we've done so, the creature falls down.
But what I'd like to see is the creature to fly back, perhaps bounce off the walls and get some kind
of force applied.
So the death impulse gives death a little bit more oomph to it.
It makes the death a little bit more impactful.
It feels better.
And especially if we're starting to do explosions and cool things with our other abilities we're going
to implement.
A death impulse can go a long way.
So for that reason, we're going to implement it.
And there are quite a few steps to it.
Now, a death impulse is something I believe should be only related to a damage gameplay ability.
So, for example, our Firebolt is a damage gameplay ability, and I'd like to be able to just set a
magnitude here for a death impulse.
I'd like to have a death impulse magnitude, and if I set it here, then I want everything to automatically
work for me so that if I kill something with a Firebolt, I want to see it fly back.
So that's what I'm interested in.
And we're going to get started by adding that parameter in the aura damage gameplay ability.
So let's go ahead and do that.
So I'm going to go into abilities and open aura damage gameplay ability.
And we're going to add a new parameter.
It's going to be a float.
We can leave it at edit defaults only.
I'm going to go ahead and paste it here.
And I'm going to call this death impulse magnitude.
And we'll give it a default value something like 60.
But we'll see what 60 looks like when we implement all this.
Now all we need to do when using this is set the death impulse magnitude and everything else is going
to work, right.
Well, for that reason we need to handle all the stuff that happens under the hood.
And we'll start with our damage effect params.
I think our damage effect params can carry the death impulse magnitude along with it.
So if I go to where we've defined that, it's an aura ability types.
So we can add the death impulse magnitude here.
So we'll make a death impulse magnitude float on our damage effect params.
And what we'll do is set this in our damage gameplay abilities make damage effect params from class
defaults, so we can go to that function.
And all we need to do here is take params dot death, impulse magnitude and set that to the abilities
death impulse magnitude and that's it.
Now once we have this, we need a way to push this along through the pipeline of damage.
And so far we just have one offensive ability that's using damage effect params.
That's our projectile spell.
So if we go to aura projectile spell in the private folder I'm going to go to the cpp file.
Here we're setting the projectile damage effect params here.
Now at this point it's really not meaningful to set a death impulse, as an impulse is a vector, and
a vector is going to depend on a direction.
And while yes, we know the direction our projectile is traveling in and our projectile does travel
linearly.
Pretty soon we're going to make this projectile have gravity.
That means it's going to have a parabolic trajectory.
And because the trajectory changes, it wouldn't be appropriate to set any vector direction at this
point.
It would be more appropriate to set a vector direction when the projectile hits.
So if we go into our actor folder and open aura projectile dot cpp, then at this point an on sphere
overlap, it would be appropriate before applying the damage effect to set some kind of vector based
on the projectiles direction for the death impulse that we can send along.
And how can we send an arbitrary vector along through the pipeline so we can receive it, say later
on, like in the attribute set where we determine if death has occurred?
Well, we know that we have a custom effect context right here in aura ability types.
It's an aura gameplay effect context, and we know how to add new things to it.
We've seen that there's a number of steps involved, and we're going to add a death impulse to this,
and we'll do that in the next video.
I'll see you soon.