Welcome back.
Now, if I take my one and only goblin here and bring it in and move it around and shock it, let's
see what happens.
I've got my number of players set to one and I'm going to stun this thing.
But before I stun, actually, we actually didn't get a chance to stun there.
Notice that things look a little funny and they also sound kind of funny.
You probably noticed.
We're applying a damage effect ten times per second, which means we're playing that hit react ten times
per second.
And that looks kind of funny.
Now, what I like to do is just not hit react.
In this case, as we're electrocuting.
I don't think we really need necessarily to play that hit react.
Instead, what I'd like to do is play a sort of shock loop animation.
If we go to assets and enemies and goblin animations spear, we can see that there's a shock loop which
looks like the goblins getting shocked, and that's going to look a lot better, I think, than simply
playing this hit react ten times a second as well as playing the sound.
It's a little obnoxious, so I'd like to fix that.
And another thing I notice is if I shock the enemy as soon as that hit react is finished, it goes into
the stunned animation a little bit abruptly.
See, it kind of jerks right there.
Watch this again.
I'll full screen it.
Right there.
It kind of jumped.
Now that has to do with blending out for the hit react.
If we go to the hit react and set the blend out time to a higher value, say 0.3, then that's going
to fix that and make it more smooth.
So again hit react.
And there's a smooth transition.
So we can do that for the spear goblin.
We can do it for the slingshot.
Hit react as well.
We'll set that blend out time to 0.3.
And we can even do it for the other enemy types as well, such as the ghoul.
We can go to the ghoul hit react to its blend out time.
It looks like it's 0.25, and we can handle the other enemies as we need to.
But what I'd like to do now is to give the goblin some kind of variable, to know that it's being shocked,
and if it is being shocked, then we should suppress that hit react.
Now, we can do this in a number of ways, but I'd like to do it very simply.
I'd like to just have a variable on the enemy, or even the base character to know if we're shocked.
And if we are, well, then we can go ahead and check that we can add a interface function to be able
to check that, and we can even have an interface function to set it really easily.
So as soon as we're say adding that.
Gameplay cue for the electric beam.
We could also set that victim to be in the shock loop.
So that's what I'd like to do in this video.
So here's what I'm going to do.
I'm going to go into a character base.
I'm going to close all tabs and go to the public folder into character or a character base, and just
under is stunned and is burned.
We're going to add another bool called be in shock loop.
Now this will be false and this could be replicated as well.
Now for in loop we won't be using a rep notify.
For now, we'll just make it a replicated variable.
No need to do anything in response to the replication.
And if it's going to be replicated, we need to add it to get lifetime replicated props.
So we'll add that here.
And it's be in shock loop.
So now that we have this, we should use.
Our combat interface to add a getter and setter for it and implement that.
So in the interaction folder here's combat interface.
Let's add two new functions.
And these can be blueprint native event blueprint callable.
So first I'll have a getter bool is in shock loop.
It'll be const.
Blueprint native event blueprint callable and we'll have a void set in shock loop which will take a
bool called be in shock.
That one we can call in shock and Blueprint native event blueprint callable.
And we'll go ahead and implement these.
And you know what.
We already have a set in shock loop don't we.
We have it right here don't we.
And we made that for the shock loop for aura right.
So we have a source of confusion potentially because aura is in the shock loop.
When casting the spell, the enemies can be in the shock loop when receiving the shock.
So to avoid confusion here, I think it's best if we use different terms.
I think we should call our new variable being shocked because in shock loop is ambiguous.
So I'm going to call this function is being shocked.
And this function set is being shocked.
And we'll go back to aura character base and we'll call the function be is being shocked.
And that way we won't have that ambiguity.
So we'll change that and get lifetime replicated props.
So we have is being shocked.
I think that's more appropriate.
And so our combat interface has is being shocked and set is being shocked.
We can override these the implementation versions in or a character base.
So we'll do that here.
Virtual void is being shocked.
Implementation and virtual Bool is being shocked.
So we have set is being shocked and is being shocked.
The implementation versions of these will generate the function definitions for these.
And set is being shocked is just going to set our boolean.
So be is being shocked equals be in shock.
That's the setter.
And then is being shocked will just return be is being shocked.
And now we have an easy way to get and set that boolean, and we just need to set it when being shocked
and use it in the animation blueprint.
Now, in addition to that, we need to check is being shocked and the attribute set before applying
that hit react.
In other words, before we activate the hit react ability so we can go to ability system and attribute
set and search for hit react.
And right here we're trying to activate abilities by react tag.
What we should do before we do that, though, is we should make sure that that character isn't being
shocked because if they're being shocked, we don't need to do the hit react.
Right.
So we're going to check and we're going to check if props dot target character implements you combat
interface.
And we're going to also check we'll just have an end here.
I combat interface execute is being shocked and we'll have to pass in props dot target character.
So if being shocked we should not hit react.
So really this should be not is being shocked if not being shocked.
Then we'll have the hit react ability activated.
So with that, we can go ahead and compile and launch.
Okay, so we're back in the editor, and we need to take care of actually being in the pose associated
with the shock loop, which means in blueprints character, we can open up enemy and we can add another
state here.
So we're going to add a new state.
We'll drag off add state and we'll call this being shocked.
And we'll have transitions to and from an end being shocked.
We'll just add a sequence player.
Now we need transition rules, which means we need a boolean so we can go back to the event graph.
And we can get is shocked now as enemy we can simply use is shocked and get is being shocked here and
we can promote that to a variable.
And we can call this.
Being shocked is being shocked is fine.
We can set that and in main states we can use is being shocked to transition into being shocked and
is being shocked with a not boolean to transition out of it.
Now we just need to set those animations for each animation blueprint so we can go to daemon app daemon.
We can open up asset override and find being shocked.
We can search for shock.
And here's a demon shock loop if you want to see it.
Here's what it looks like.
Now you could speed it up, if you like, by setting the rate scale to 1.25, maybe even 1.5 if you
like.
The demon one is a little bit slower.
So there's the demon.
We can go back.
And open up Google.
Go to asset override.
For as being shocked.
We can use Shock Loop for the ghoul.
And here's what that looks like.
So being shocked looks shocking.
So we have that.
We can go to our next enemy.
Goblin slingshot.
Go to asset override and for being shocked we can use shock loop.
There's hit react shock loop spear.
It should be the same as shock loop, so that's fine.
And we can get the goblin spear.
Go to its asset override and search for shock here.
And use shock loop here.
Okay.
Next is our shaman.
And for the shaman.
We can search for shock and use Shaman Shock loop, and you can look at those if you want to see them.
But we'll go ahead and just test those out, starting with Goblin Sphere.
So after saving all and we do have to actually set that boolean when shocking.
So we'll do that.
But also keep in mind if you press play and your enemies are frozen, you just need to go in and compile
those animation blueprints for all of them.
So if I go to Goblin Spear and compile it, you'll see that it works again.
So just make sure to go in there and compile these all.
Before trying to use them.
And you should be fine.
Okay, so before we can test this out, we have to actually set that boolean.
And we're going to do that from our electrocute ability.
So let's go to abilities lightning electrocute.
And when should we set that boolean.
Well it should coincide with the electric beam.
So if we go to spawn electric beam and look for where we're adding a gameplay cue on actor, we want
to also set that boolean, but only if the first target implements interface.
If that's the case, that's when we want to do it.
So if the first target implements the interface, then we want to set that boolean on the mouse hit
actor which will be the target.
And then we want to set it on our additional targets.
So before anything else we'll take the mouse hit actor or target.
Because if we're in the true case here, they're the same actor.
So we can take cue target.
Or mouse at actor here.
And what we're going to do is right click and set in shock loop.
And we'll hook that in as the target and set this to true.
And we'll be setting that there.
And then for the additional targets, we can do this in our array.
For each loop we can set in shock loop.
And we can use our.
Array element.
I'll go ahead and just do it first.
In an attempt to avoid crossing too many wires.
So we'll set the array element.
As the target there and set this to true.
Now, when are we going to set it back to false?
We need to do that when we remove the queue and we remove the queue.
If you look in clear timer and end ability we go into prepare to end ability.
And here is actually where we're going to remove that queue.
I just see a couple of wires.
There we go.
So before we remove the queue, we definitely only want to do it if the first target implements the
interface.
If it does, here we're taking our mouse hit actor.
We're removing the gameplay queue.
At this point we can also set in shock loop.
Passing in that mouse head actor here.
Like so, and we'll set it to false.
And then we do this for each actor when we're removing the shock loop.
Q and it doesn't matter if we do it when we check for authority or not.
It's a replicated variable regardless, but we could set it locally.
So we'll go ahead and do that.
We'll make some room.
And we'll say set in shock loop.
Using the array element here.
Like so, and we'll set it back to false.
And with that, we can test.
So let's test out on the goblin first.
Okay.
Didn't work, so we need to make sure.
We go to character.
Enemy to the event graph.
Okay.
We have is being shocked.
I think I might have called the wrong function we actually should be calling.
Set is being shocked, right?
Set is being shocked, of course.
So we need to make sure we do that in every case here.
Got to call the right function.
So here set is being shocked.
This is when we're removing it right and right here instead of set and shock loop we need to set is
being shocked.
We even named these different names and I still got them mixed up.
Passing in the target there.
And I also need to check when we're applying this in spawn electric beam.
Yeah, I set in shock loop didn't I?
This should be is being shocked.
So set is being shocked.
And before I even continue, I'm just going to look in my attribute set.
Yes is being shocked.
I did check the right function there.
So here we're going to check in shock.
Conicet is being shocked with the target not in shock loop.
That's the wrong one.
And then we can do this for.
All the additional targets set is being shocked.
Easy to get them confused.
And we need to check in shock for this.
Okay, now we can test this out.
There we go.
Now we see the shock loop.
And it's not spamming that hit react sound, which just sounds awful.
Now things look good and we can test all of the enemies include the Demon Ranger.
The demon warrior.
I'd like to make these all face forward so we can see them better.
The goal.
And the Goblin slingshot.
We don't have that out.
And the shaman.
We'll bring that out as well.
With that.
Let's test these.
We can also see how they look in the stun loop as well.
So we can test out shocking all these.
So first we'll try the slingshot goblin.
Looks good and sounds good.
Let's try the ghoul.
Awesome.
Let's try the shaman.
Shaman.
Looks good.
Spear.
Goblin.
Excellent.
And our demons.
There's that one.
And there's that one.
Let's try on the client as well.
So we're on the client.
Looks great.
Looks great and we'll see what it looks like on both.
Excellent.
Okay.
So we now have shock loop animations and those are looking good.
Excellent.
So we have two different kinds of debuffs.
We have burn.
And we have stun.
And enemies can be burned and stunned at the same time as well.
So things are looking great.
Awesome job.
I'll see you in the next video.