Welcome back.
So we're ready to tie all this together on the C plus plus side we've gotten all of our steps implemented.
I'm going to go ahead and just leave these steps here.
Just because this is kind of explaining the pipeline for radial damage.
And I think it's nice and informative.
So I'm going to leave it there and we're going to go ahead and launch the editor okay.
So we're back in the editor.
We're going to open up Arcane Shards.
I'm done with my animation montage, I'm done with my gameplay queue.
And here's my Arcane Shards ability.
So what I want to do in arcane shards is I want to cause radial damage, which means we're going to
need to make sure our class defaults are all set up.
We have a damage effect class.
That's good.
We also need to set damage.
So if we use a curve table, we can use CT damage.
But that means we have to go into CT damage.
And we need to add a curve for this spell.
So let's add one.
Rename the curve.
We'll call it abilities Dot Arcane shards.
We'll add two points two keys one two.
The first one will be at level one.
And I'll just make it ten damage.
And then the second one.
Will be at level 40.
We'll just make 40 kind of the de facto max.
And at 40, we'll give it, oh 100.
Now that's too low.
Let's do 200.
Okay I'm going to go ahead and make these an auto curve.
And I'm going to make the curve look like this.
But I'm going to go to normalize view mode so I can see really what that curve looks like.
And I'll have a falloff like this.
Okay, great.
Now we have a curve back in arcane shards we can select the curve arcane shards like so perfect.
Now I'm going to set debuff Chance to zero.
We don't have an arcane debuff associated with this damage type, so for the moment I'm just going to
set it to zero.
We don't need debuff damage or frequency or duration.
Now.
Death impulse magnitude.
We've been using a thousand.
It looks like for most of our spells I say most, but I mean Firebolt.
That's been a bit too high.
So I'm going to set this down to about 200.
Knockback.
I would like knockback.
I'd like some knockback for this.
I'm going to leave it at 1000 and knockback chance is going to be 100%.
I'd like this spell to always knock back.
It has knockback.
Now is radial damage.
Yes please.
And radial damage inner and outer radius.
Well that's something we're going to want to experiment with isn't it.
And we can experiment with some debug spheres.
What I'm going to do is instead of just drawing a debug sphere like we were doing before, I'm going
to draw two of them.
One for the inner and one for the outer radius.
So I'm just going to make some room here.
And we'll do the first one and it'll be white.
We'll make it kind of a light pinkish, actually.
And for the radius I'm going to use radial damage.
You know what my radial damage inner radius is not blueprint read only.
I'm just going to quickly change that.
Closing down, saving all.
I'm going to go into public ability system abilities or a damage gameplay ability, and I'm going to
make these radial damage inner and outer radius blueprint read only.
And I'll go ahead and start debugging again.
Okay, so took a second to recompile, but worth it.
I'm going to close down CT damage and zoom in on draw debug sphere, and I'm going to draw the inner
and outer radii.
So I'm going to say radial damage inner radius I'm going to get that.
And that'll be my radius.
And it's going to be at the shard spawn location.
And I'm also going to draw a debug sphere at the outer radius.
So I'm going to use radial damage.
Outer radius.
For this one and same location.
And the outer is going to be slightly more red.
And we'll hook this up and we'll just see how it looks.
And you know what?
I'm just going to set this to one player so it's faster to load.
Okay, I didn't get any debug spheres and of course I didn't.
My radial damage parameters are zero, so I'm going to set these.
Okay.
We're going to experiment a little bit here.
So radial damage inner radius.
I'm going to put it pretty small, like 25 and outer radius.
I'm going to try to 50 and we'll see how that looks.
Actually I'll try 300 and we'll do 50 for enter.
Let's see how this looks.
Okay, that's kind of cool.
Um, it's a little big.
I'm going to put it down just a tad.
So 300 is too much.
Let's try 200.
I don't even think I saw the inner radius.
I might need to make that a little bit more of a dramatic color.
We'll make it blue.
All right, so let's do that.
Okay.
That's looking pretty good.
So if we're on the outer edges of those spheres, then we, being the victims of this spell, will get
less damage and max damage.
If inside that, I think the inner sphere could be just a little bigger.
Maybe 85 is okay.
And the outer can be probably a little lower.
180.
No.
I think my inner can go back to 50 and my outer can come back to 200.
I think I like that.
Okay, so now that we have these spheres figured out, we know that we have some pretty decent radial
damage settings so we can actually try to cause damage.
So what I'd like to do is I'd like to create some damage effect params.
So make damage effect params from class defaults.
The target actor is going to be the avatar.
And then we're going to call apply damage effect on our ability system blueprint library.
So with that.
We should now be causing damage and it should actually be radial.
And so in order to test radial damage, I'm going to set the num points down to one.
And that way I'll have more fine tuned control and I can see how much damage I cause to this poor goblin.
And luckily I have this circle.
And if I just do it over to the side.
Oh, I got some damage myself.
It looks like even though I have zero damage, I still got some knockback.
Okay?
So it's not affecting the enemy.
It's affecting me.
That means I'm using source or target incorrectly somewhere.
Oh, right.
Of course.
Target actor is not me.
Target actor is who we want to apply the damage to, right?
Of course.
So that means we need to do this to everything within the radius.
We have a way to do that, don't we?
We have get live players within radius.
Perfect.
Now get live players within radius needs a world context object.
For that we can use get avatar.
So we'll pass in the avatar actor from actor info.
We can even use an array of actors to ignore, which I'd like to just pass in my avatar.
Straight in.
I want to ignore my avatar.
Now the radius is going to be my radial damage outer radius, because no point in going bigger than
that.
Nothing would even get damaged.
And then my shard spawn location can go into Sphere origin.
We're going to need to do some cleanup here, but just getting this working.
We're going to apply the damage effect and then increment the count, right.
So we need to apply the damage effect to everything in this array.
I'm going to go ahead and promote this to a variable called overlapping players.
And I'm going to go ahead and loop over it.
So we'll do a for each loop.
And for the loop body, we're going to apply the damage effect.
We'll make params for each of these.
So the array element is going to be the target actor.
And we'll apply the damage effect.
And only when the loop has completed will we resume and increment our count.
So this is for each shard.
It's going to damage everything that's overlapping with it.
Oh boy I don't like these overlapping nodes.
Okay, we'll fix it though.
Now, at this point, we've almost tied everything all together and we're almost ready to test.
There's just one little detail that we need to take care of, and that's setting the damage origin.
We're never actually setting that.
We need to set that in our damage effect params and make damage effect params.
Can't really do that.
It doesn't know yet what the damage origin should be.
Now we could take this.
Break it.
Expand it, and then we can make a new one.
From one of these we can say make damage effect params.
Expand it and then we could set the damage origin right here the radial damage origin.
And then for all these others we can drag them across and connect them.
But that sounds like a nightmare.
I don't really want to do that.
I'm not interested and just dragging that many nodes together.
Although what I'm about to do to avoid it is probably going to take the same amount of time after compiling
in C plus plus, but instead of having to do this.
Just like we have a target actor input and to make damage effect params from class defaults, we can
simply pass in a radial damage origin here and just take care of it that way.
That's the way that I'd rather go about this.
So I'm just going to go back into the C plus plus side.
We're going to go into aura damage gameplay ability and our function make damage effect.
Params from class defaults can take in a const f vector reference called in radial damage origin, and
we'll set it equal to f vector zero vector by default, so we don't have to pass it in.
Now we do need to add this to the function definition.
Right here.
And we can take our params and we can set it so we have radial damage origin here.
And we're not going to set it to our member variable.
In fact this doesn't really need to be a member variable does it.
So we're going to take that in radial damage origin.
We're going to set radial damage origin here.
And we never actually need a radial damage origin member variable in this class actually.
So we can actually remove radial damage origin from the gameplay ability itself.
Never used.
We need to provide that radial damage origin when we make the params.
So with this change let's go ahead and compile.
And with that.
We'll get back into our ability and this is now broken.
So we're going to have to right click on it, refresh nodes.
And if we're using this in other abilities it's going to be broken there too.
So we'll just be prepared for that.
But for in radial damage origin that's going to be our shard spawn location.
So we can pass that in straight into it.
And now we have our radial damage effect params.
So let's test this out and then we'll come back and clean up these nodes.
We'll go ahead and press play.
And of course, we do have errors now because we changed those functions.
Let's first start with electrocute.
And let's find that error going into apply damage.
Nope, it's not in that function.
It might be in prepare to end ability.
Here it is.
So we're calling make damage effect params from class defaults.
We can right click and we can refresh the nodes.
And that's going to fix it.
And we'll do it on both cases here.
Okay by ref params.
Expect a valid input to operate on and since we don't have one to pass in.
I'm going to go ahead and pass it in by value.
So this will just be enough vector not even a const reference.
We'll have an f vector.
Radial damage origin.
Like that.
So let's try this again.
And that should get rid of all the errors anyway.
Okay.
So let's go ahead and press play.
And yes, that takes care of it.
And just going to make sure we're all ready.
We're all set.
We got the spawn location there.
Let's go ahead and press play.
And.
There's our circle.
So I'm going to try getting that enemy right at the edge of the circle.
So moving it in closer.
We're about to hit it.
There we go.
It blocked.
What?
It got one damage.
That was two damage.
That was a critical hit.
Okay, so block is one damage.
One damage.
I'm going to go right in the middle.
That was six damage.
Six.
Damage in the middle.
We get blocks, but two damage right there.
I think what I'm going to do is set the duration for these debug spheres to be a little bit less.
Let's do two seconds.
Okay.
So right in the middle we get six damage.
And at the edge.
If it's not a critical hit, it's about three.
Two.
That was two.
And we got a critical hit.
So it'd be nice to be able to turn off certain damage mechanics just for testing purposes.
I might think about doing that, but.
At the very edge I'm seeing.
I'm getting one damage and in the middle.
That was a critical.
But.
In the middle.
We should get more.
We get six in the middle.
Okay.
Now I'm just going to double check my data.
I'm going to go to CT damage.
Arcane shards.
Okay, so at 0.3 is my first key.
That should be level one and it should be at ten.
So I want a base damage of ten at level one for my arcane shards.
Not sure how that happened, but.
Okay, so that was for damage.
Getting one at the edge.
And I got about nine there in the middle, so that's looking good.
We're definitely getting a fall off, so I'm really happy with that.
Now we can clean up our nodes.
But before we do, I want to bring your attention to one more thing in C plus plus.
And that's in our exit calc damage.
You see, in our Exit calc damage, we're looping over all the damage types, which means every time
we check is radial damage.
If it is radial damage, then for each damage type, we're binding our lambda to the delegate and we're
calling apply radial damage with falloff even though that damage type value is zero.
So really, there's no point in doing all this if that damage type value is zero.
In other words, after we set our damage type value based on our set by color magnitude, we should
check to see if it's zero.
If damage type value is zero, we can even do less than or equal to zero.
There's no point in doing the rest of this iteration of the for loop.
We can continue.
So continue is going to skip all the rest of the stuff inside this for loop and do the next iteration.
So that's one thing I'd like to do is just continue.
If we have zero damage there.
So with that, we've got a little bit of an optimization done there.
Okay, so we're back in the editor, and before we clean up our nodes, after I made that C plus plus
change, I want to make sure that I'm still getting radial damage with the falloff.
Okay, so I got two damage there.
Let's do it in the middle here.
And I got nine damage there and neither were a block or a crit, so I know I have radial damage with
a falloff.
Perfect.
Okay, so the shards are looking good.
I don't need my debug spheres here anymore, so I'm going to go ahead and just remove my draw debug
spheres.
Don't need them.
And I think this could use some serious cleanup.
We really don't want too much stuff getting out of control here.
So after we set the timer, we're hiding the magic circle and spawning our first shard.
This can get a comment.
Start timer and spawn first shard.
I'm going to have a little bit of a more greenish green.
And move that up into here.
Now, after we do that, we implement spawn shard, which is called in our timer over and over again.
So we're storing our shard spawn location.
This can be a function.
We can call this store shard spawn location.
Now we're getting our avatar actor.
We're making an array from it, and that's passed in to get live players within radius as the array
of actors to ignore our sphere origin is our shard spawn location, which doesn't need to be an output,
actually.
So I'm going to control Z a couple times.
And I don't really need this to be an output.
It's just shard spawn location.
We can just pass that in.
Shard spawn location there.
And then I can collapse this.
To store shard spawn location.
So we get it from our ground points based on our count getting its world location there.
Okay.
After that we call get live players within radius here.
And what we can actually do is we can make this a function as well to store our overlapping players.
So we're seeing how many players are overlapping with our damage outer radius.
So really this is collecting all of the damaged players or players to damage.
So overlapping players could be called players to damage.
I like that name better because it's a little bit more descriptive, and then rather than plugging it
straight from the set into the for loop, we can take players to damage the array variable and plug
that in.
And then this can be a function.
We can collapse it and we can say store players to damage.
After that, we're performing our loop.
And we're just applying a damage effect on this array element.
So we could make this a function, cause damage to player or cause damage to actor at shard spawn location.
So let's just collapse this.
And call this radial damage to player.
That's better.
We'll move this up here.
And then last we increment the count.
And then we execute a gameplay cue.
So let's go ahead and move this down to here.
Increment that count.
And then here we're making gameplay parameters.
We can collapse this down.
Like so.
And here we can bring it in.
Make this look a little bit.
Less messy.
And after all this, in the false case here, we clear the timer.
We set a delay.
Really we're going to need to do a commit, implement ability, cost and cooldown.
Right.
But we destroy the point collection and end the ability.
So right there this is something we could comment but.
I'm going to leave it as is because we're going to change it.
We need to figure out how we're going to do cost and cooldown for this ability.
But now this ability is looking a lot better.
So we start the ability.
We show the magic circle.
We wait for an input press.
Once we get it, we get the target data under the mouse.
We store the mouse hit location.
After that.
We spawn our point collection at the mouse hit location, store that in a variable we call get ground
points.
Passing in the point collection, the mouse hit location and the number of points and a random float
for the rotation, and we store our ground points.
We update the facing target for the montage, we play the montage and wait.
We wait for a gameplay event.
Once that event Arcane Shards is received, then we start our timer on looping.
We store that timer, we hide the magic circle, and we spawn our first shard while we wait for this
timer to go off and spawn the next one only if the count is less than num points, we store the shard
spawn location.
We store the players to damage.
We loop over players to damage and cause radial damage to them.
We increment the count and then we execute a gameplay queue with params on the owner using our shard
spawn location.
Once the count is greater than or equal to num points, we've spawned enough shards.
We clear the timer.
After 0.2 seconds, we destroy our point collection and we end the ability.
So we have our arcane shards.
All we need to do is implement a couple things.
Cost and cooldown for one.
We can't just be casting this willy nilly without paying for it.
But it's looking good.
Now note to self.
I may want to increase the gravity force.
As my characters are kind of flying through the air a little bit too slow.
It's a little too realistic.
But otherwise our abilities.
Looking nice.
Really nice.
Excellent.
Awesome job and I'll see you in the next video.