Welcome to your next quest.
In this quest, you're going to spawn the firebolt from the event.
In other words, as soon as the event happens, spawn that firebolt.
So this will be a little bit different.
Now we're no longer spawning a firebolt.
As soon as we activate the ability, we're waiting for that event to happen.
And in response to that we'll spawn the firebolt.
So there are a couple of things you'll have to do.
I'm going to leave it up to you to figure it out, and then we'll go over the solution together.
So pause the video and conquer this quest now.
Okay, so I'm in my aura projectile spell and here's activate ability.
Now we know that this is automatically executed when we activate the ability.
And what we're doing here is we're spawning a projectile.
Well, now we're going to need to spawn the projectile a little bit later on.
So activate ability isn't the greatest place to do it.
What I'm going to do is make a blueprint callable function so we can do this in response to waiting
for a gameplay event.
So I'm going to go into my Aura projectile spell header file and I'm going to close all other tabs and
here I'm going to make a blueprint callable function.
I can let this be a protected function.
We'll put it right here.
It'll be void.
And I'm going to call this spawn projectile.
For now, I'm going to leave it without any input parameters that might be subject to change in the
future.
And I'm going to make this a new function with Blueprint Callable.
We'll give it a category projectile.
So I'm going to go ahead and generate the definition and all I'm going to do is copy the code that I
have and activate ability.
So I'm going to actually control X to cut it, control V to paste it.
Now here's a problem.
We don't have our activation info, right?
But we can always check to see if our avatar actor has authority.
So if we type, get avatar actor from actor info, this will return an actor that is our avatar provided
that we have one and if we have one then we can call has authority from that avatar actor.
So I'm going to use that control X and Replace has authority here with this call.
There are always options, right?
So Spawn Projectile is going to check to see if we're on the server.
If we are, it's going to spawn the projectile.
So this is what I'm going to do in response to the gameplay event.
Now it's blueprint callable, so all I need to do is call it from the blueprint.
So let's do that.
I'm going to run in debug mode.
And I'm going to go ahead and open up my ability.
G a firebolt.
And right here, in response to an event received, I'm going to call the blueprint callable function
spawn projectile.
So right here event received spawn projectile and we can test out how this works.
Saving all first pressing play clicking on an enemy.
And I see that we get that projectile spawned and we don't see it until that anim notify is hit.
And of course, we can always slow that animation down by changing its rate scale.
I changed it to 0.1.
And boom, it spawns right there.
At that point in the animation, which is exactly what I wanted.
Perfect.
So now we know that we can do things at a particular point in an animation montage or really at a particular
point in the game period.
All we have to do is send a gameplay event.
Now, if this particular ability is active, when that event is received, as long as we've reached
wait gameplay event, then the ability can be waiting for a gameplay event to occur.
Now, once we've spawned the projectile, perhaps we can end the ability here with an ability and then
we should be able to activate the ability again.
So now if I spawn a projectile.
And then since I've already spawned one, I can activate it again.
So this is a pretty fast animation.
So if I'm holding my left mouse button down, we'll spam it pretty quickly.
But we're going to soon learn how to implement Cooldowns for abilities.
So spamming abilities is not going to be a problem.
Excellent.
So now that we're spawning the projectile at the correct point in time, it's time to take care of a
few other issues.
Right.
Our character is facing this way and we click and we send the projectile that way.
That's a problem.
We also want to orient our character in the direction that they're launching the projectile too, don't
we?
So we have a number of things that we'd like to do.
For one, we want to know the location in space that we're supposed to launch our projectile towards.
So we're going to learn how to do that in the videos to come.
Great job and I'll see you soon.