Welcome back.
Now, before wrapping up this section, there are a few things I'd like to do.
One is it's about time for some multiplayer testing.
So we're going to do that and then we may upgrade a couple of cosmetics involving some of our gameplay
so the things look better.
But for now, let's just try testing this in multiplayer and seeing if we've introduced any bugs or
anything that we should fix first.
I'm going to set to play as listen server number of players should be two, I'm going to press play
and on my client I'm going to launch a projectile and right away I see an exception.
So let's flex our debugging muscles and see what we can find here.
Now let's see where in shared pointer H and we have an access violation.
Looks like we're trying to access a null pointer if we follow the call stack one level up, we're in
gameplay effect h and get context.
So we're returning effect context.
Looks like the gameplay effect spec that we're in.
That's this pointer is null.
And then one level up on the call stack we're in on sphere Overlap.
So let's see what we're doing here.
That's not good.
Now we're in this second if statement and we saw that the effect spec was null and that's not good because
this effect spec handle data dot get is accessing that pointer.
So I seem to recall thinking that we checked that up here.
Right?
If we check that here, why are we still getting down here?
Well, that must mean we made a mistake up here.
And now that the debugger has brought my attention to it, I'm definitely seeing my mistake.
I made a logic error here.
You see, I'm checking damage effect spec handle data dot is valid.
If it's valid, this will be true.
We don't want to return.
If it's true, we want to return.
If it's false, we want to return if it's not valid.
So if we replace that with not is valid, well, that's a start.
But we have an end here, right?
We're checking to see if the spec handles effect causer is equal to the other actor.
Now, an end means both of these have to be true to enter this if statement.
But really either one of them should make us return early.
If the spec handle is not valid, we should return.
And if this condition is true, we should return.
So really this should be an Or so that was my logic mistake.
But we found it.
And it's quite possible that as you were following along, you might have seen these types of little
logic.
Mistakes are easy to sneak in, and the way to prevent them or clean them out is by testing and being
careful.
So I'm going to go ahead and hit stop.
And with this fix in place, I expect to be able to launch a fireball on a client without hitting that
exception.
So let's try that again.
So here we go.
We have a number of players set to two.
We're playing as listen server and I'm going to grab my client and launch a fireball and things are
fixed.
Let's see if we can take damage.
Let's see if we can defeat some enemies, maybe kill a couple.
Looks like my client is dead already.
This is actually getting quite difficult with this many enemies, and that's actually kind of fun.
I like it.
Another thing I'm noticing is my shaman does not dissolve like my other enemies do.
I kind of like how the ghoul just sort of turns into a giant bird and it spreads its wingspan there.
That's kind of cool, but our shaman does not dissolve, so that's another thing.
It's not really a multiplayer test issue, but it's more just something I just realized while testing
and we can take care of that too.
So why don't we do that?
I'm just going to edit BP Shaman.
I'm going to select the mesh and browse to it.
And here I have a materials folder.
Here's my shaman.
Pretty simple material, but I'm going to turn it into a material that can be dissolved, which means
I need to go to assets, materials M dissolve effect and copy this big piece right here.
Ctrl.
C Come back to Shaman, Ctrl V.
Now remember, this comment tells us some properties that our material has to have, so we need to select
M Shaman over there and make sure that material domain is surface.
Blend mode is masked.
That's the only one we have to change.
And shading model is default lit.
And then this one goes to emissive color.
So we'll bring it down and stick it in.
And then this other one goes to Opacity mask.
We'll bring it in, stick it in and notice that our material is partially dissolved.
We saw that giving this dissolve parameter a negative two by default fixes that.
And then we need a material instance based on Im shaman.
So we can browse back to Shaman, right click on it, create a material instance, call this my underscore
shaman, underscore, dissolve.
And now we have a dissolve material and we can set that in Bpy Shaman by selecting Bpy Shaman self searching
for Dissolve.
And we have that material instance.
We're going to set that to me.
Shaman Dissolve.
Now the shaman has a weapon too, which means we need to do this for the weapon.
So let's do it.
I'm going to select the weapon.
I'm going to browse to it, go to its materials and open its material.
Im staff.
Let's see if I still have that collection of nodes copied to my clipboard Ctrl V and yes I do.
That's awesome.
So let's change the material properties.
Really, we just need to change the blend mode to Masked and we're good.
And then we can take this to emissive color and stick it into emissive color there like so.
And we can take this one to opacity mask.
We can stick that in opacity mask and we can take our dissolve and set it to negative two.
Now we have a staff and we can right click on it, create a material instance called me, I'm going
to call it Shaman Staff.
Underscore dissolve.
And now that we have that, we can go back to BP Shaman.
Search for dissolve and hit that left arrow to set this to that material instance.
Now, if we go in and kill the shaman, we should see it dissolve.
Let's just make sure that that works.
And it does not.
So let's find out why.
I'm going to go to Content Blueprints, Character and Open Enemy base where we have our Start dissolve
timeline and we have these scalar parameter value dissolve.
I believe we ran into this with the Google, didn't we?
Let's go back to our M Shaman material and browse to it so we can open my shaman.
And I don't see those parameters there.
So we're going to go back to M Shaman and apply and then back to my shaman dissolve.
And now I see those parameters.
We need to do that for M staff as well.
We need to hit apply and if we browse to that and check it out, here's the Shaman staff.
Now I see the parameters.
With that, we should be able to test this out.
I'm going to save all first and then.
We can try to kill the shaman and it dissolves and it looks awesome.
Excellent.
Awesome.
All right.
So that takes care of that issue.
So things are looking pretty good.
I think we can just add a few more cool cosmetic touches to our current gameplay mechanics.
But after that we're ready to move on to XP and leveling up.
Great job.
I'll see you soon.