WEBVTT

00:06.910 --> 00:07.990
Welcome back.

00:08.170 --> 00:13.210
Now, we've gone through a lot of trouble just for a couple of Boolean values.

00:13.210 --> 00:19.180
But now that we have those Boolean values, we can show some visuals to the player.

00:19.180 --> 00:24.340
Whenever we cause damage, we can show whether that damage was a blocked hit or a critical hit.

00:24.430 --> 00:28.030
So while that seems like something small, it's actually not.

00:28.060 --> 00:33.160
There's a lot of thought that goes behind blocked and critical hits and how to show them.

00:33.460 --> 00:38.950
Now we know that our attribute set show floating text function receives these values.

00:38.980 --> 00:42.550
Now we need those values to make their way into the widgets.

00:42.640 --> 00:49.480
Now what we're doing to show the damage number is calling the player controller function show damage

00:49.480 --> 00:50.020
number.

00:50.020 --> 00:51.700
Let's take a look at that function.

00:51.700 --> 00:53.260
I'm going to go ahead and go to it.

00:53.470 --> 00:55.240
Here's show damage number.

00:55.330 --> 01:02.170
And in the CPP file, it is way up here, at least in my case.

01:02.170 --> 01:08.580
And look at this implementation seems to indicate that it's an RPC and we know that it is right.

01:08.590 --> 01:09.880
It's a client RPC.

01:10.390 --> 01:10.900
Okay.

01:10.900 --> 01:16.990
So in the player controller here, we see that what we're doing is we're taking the damage amount and

01:16.990 --> 01:18.340
the target character.

01:18.370 --> 01:26.230
We're creating a new You damage text component where registering it, attaching it to the root component

01:26.230 --> 01:33.520
of the target character, detaching it shortly thereafter and then calling set damage text on that you

01:33.520 --> 01:35.380
damage text component.

01:35.410 --> 01:38.290
This is where we pass along that damage amount.

01:38.320 --> 01:39.880
This is where it's at.

01:39.910 --> 01:48.640
This is where we want to pass those booleans across to this damage text component so it can respond.

01:48.670 --> 01:50.920
So we have a few things to change here.

01:50.920 --> 01:54.490
For one, set damage text needs to take those booleans.

01:54.490 --> 02:00.160
For another thing, show damage number needs to take those booleans, look at that extra space there.

02:00.310 --> 02:07.550
And in addition to that, in aura attribute set, we need to pass that info in to show damage number.

02:07.550 --> 02:12.080
So let's start here with show damage numbers so we can pass that info in.

02:12.080 --> 02:18.710
So here in Aura player controller show damage number gets two new booleans actually rather than type

02:18.710 --> 02:25.490
them out, I'm going to be lazy and copy them by going into aura attribute set and getting them right

02:25.490 --> 02:25.940
here.

02:25.940 --> 02:30.200
Bool be blocked, hit bool, be crit hit or critical hit.

02:30.200 --> 02:35.480
I'm going to copy them from here and go back to aura player controller and paste them into show damage

02:35.480 --> 02:36.710
number here.

02:36.710 --> 02:41.930
And then I'm going to go into Aura player controller CP and paste them in here.

02:42.110 --> 02:48.200
And now that I have those, we need set damage text to take in those booleans and that exists on the

02:48.200 --> 02:50.210
damage text component.

02:50.360 --> 02:52.130
So let's go to that.

02:52.370 --> 02:58.700
We're going to go into UI widget damage text component here, set damage text.

02:58.700 --> 03:00.770
We're going to add those booleans here.

03:00.890 --> 03:02.330
It's a blueprint implementable event.

03:02.330 --> 03:05.480
So we don't have a implementation in C plus plus to change.

03:05.480 --> 03:06.770
So that's fine.

03:06.770 --> 03:09.950
We'll have to go into Blueprint to handle it from there.

03:10.040 --> 03:15.740
But now that this has the inputs that we need it to have, we can go back to aura player controller

03:15.740 --> 03:19.760
and pass those booleans through into set damage text.

03:19.760 --> 03:26.750
So first is B blocked, hit second is B critical hit and now those are passed along.

03:26.750 --> 03:29.900
But now show damage number needs those booleans as well.

03:29.900 --> 03:34.880
So we can go back to aura, attribute set and pass along those booleans here.

03:34.880 --> 03:39.620
It's going to be B blocked hit and B critical hit.

03:40.190 --> 03:40.850
Okay.

03:40.850 --> 03:43.400
So now we're all set on the Cplusplus side.

03:43.400 --> 03:46.790
We're getting those values from the effect context.

03:46.820 --> 03:49.400
We're passing them in to show floating text.

03:49.400 --> 03:52.640
Show floating text is passing them into the player.

03:52.640 --> 04:00.320
Controllers show damage number, show damage number is passing them through to the damage, text components,

04:00.320 --> 04:02.300
set damage, text function.

04:02.300 --> 04:05.330
And from there we handle it in blueprint.

04:05.330 --> 04:09.680
So let's go ahead and get this working in Blueprint.

04:09.710 --> 04:12.050
Now it looks like I have my editor open.

04:12.050 --> 04:17.360
I'm going to close it down and compile and launch by hitting the debug button.

04:19.900 --> 04:20.410
Okay.

04:20.410 --> 04:27.550
So back in, the editor where I want to go is in Blueprints UI and the floating text folder.

04:27.550 --> 04:29.390
Here's what I'm concerned with.

04:29.410 --> 04:31.090
I'm going to open up both of these.

04:31.090 --> 04:38.650
Here's my damaged text component blueprint and I'm also going to open up my damage text widget blueprint

04:38.650 --> 04:39.250
here.

04:39.340 --> 04:44.290
And if I go to the graph here, I have an update damage text function.

04:44.290 --> 04:49.000
And if I go to my text component, we have event set damage, text.

04:49.000 --> 04:52.180
And look, it now has blocked, hit and critical hit.

04:52.210 --> 04:56.770
So now that we have access to this information, we need to pass it through to the widget.

04:56.770 --> 05:00.940
So update damage text should take these two booleans now.

05:00.940 --> 05:07.240
So I'm going to go back to update damage text here in my widget and I'm going to add two new inputs.

05:07.240 --> 05:16.000
First is a boolean called Blocked Hit, and next is a Boolean called Critical Hit.

05:16.150 --> 05:18.070
And we just need to pass those through.

05:18.070 --> 05:23.600
I'm going to compile this, go back to my component and we're going to pass these along.

05:23.600 --> 05:30.710
I'm going to take blocked, hit and drag it down to here, get a reroute node, drag it over to here,

05:30.860 --> 05:34.820
get a reroute node and then hook it into blocked hit.

05:35.090 --> 05:41.240
We'll do the same thing for critical hit, get a reroute node, drag it over, get a reroute node and

05:41.240 --> 05:42.650
hook it into critical hit.

05:42.680 --> 05:49.160
So we're passing that info along and I can use the Q key to straighten these out.

05:49.640 --> 05:56.600
And if you're OCD, you're going to probably straighten these all out and make them all evenly spaced.

05:56.600 --> 06:03.380
And if you haven't used electronic nodes and dark nodes, those are a really nice way for you to organize

06:03.410 --> 06:04.670
your blueprint nodes.

06:04.670 --> 06:07.310
Just passing that info along there.

06:07.700 --> 06:08.150
All right.

06:08.150 --> 06:15.920
So now update damage text has the information and if we go to update damage text, we can decide what

06:15.920 --> 06:17.570
to do with that info.

06:18.020 --> 06:22.610
Now we're setting the text damage using this number here.

06:22.820 --> 06:32.060
And what we can do is we can set the color of the text based on whether or not it's a blocked or critical

06:32.090 --> 06:33.770
hit or maybe both.

06:33.890 --> 06:39.860
So I think what I'd like to do is make a nice handy function that can take in both of these booleans

06:39.860 --> 06:47.810
and perhaps return a color, and then we can just use that color as a sort of local variable to set

06:47.810 --> 06:49.380
the color and opacity.

06:49.380 --> 06:51.810
I think that would be a nice, clean solution.

06:52.080 --> 07:01.410
So I'm going to add a new function called get color based on block and crit.

07:02.140 --> 07:05.320
Now, this will require two boolean inputs.

07:05.350 --> 07:13.660
One called is block and another called is crit is crit there.

07:13.780 --> 07:16.150
So a hit can be either blocked.

07:16.180 --> 07:19.810
It can be a critical hit or it can be both.

07:20.200 --> 07:26.380
And depending on whatever combination, our function should output a color.

07:26.530 --> 07:28.750
So I'm going to add an output.

07:28.750 --> 07:32.530
And for the type, I'm going to choose slate color.

07:33.500 --> 07:40.130
The slate color structure is what I'd like to return based on whatever combination we have here.

07:40.220 --> 07:42.680
So I'm going to disconnect that pin for now.

07:42.680 --> 07:46.370
And my return node can be called color.

07:46.640 --> 07:49.850
So let's check the various combinations first.

07:49.850 --> 07:56.930
I'm going to check if is block is true, but I'd also like is block to be true and is crit to not be

07:56.930 --> 07:57.470
true.

07:57.470 --> 08:00.440
So I'm going to use an and boolean.

08:01.660 --> 08:05.550
And for the second condition is crit should not be true.

08:05.560 --> 08:07.270
So I'm going to use a not boolean.

08:07.270 --> 08:12.130
So both is block is true and is crit is not true.

08:12.130 --> 08:18.760
In this case we're going to have a color for a blocked hit that's not crit.

08:18.760 --> 08:25.120
So I think what I need to do here is promote this color to a variable.

08:25.120 --> 08:26.830
It can be a local variable.

08:26.830 --> 08:31.570
So promote a local variable and we're going to call this out color.

08:32.200 --> 08:34.150
And that's what we're returning from.

08:34.150 --> 08:36.880
The function and out color can be set.

08:36.880 --> 08:41.350
So we're going to alt drag out, out color and set it.

08:41.350 --> 08:43.030
And what are we going to set it to?

08:43.030 --> 08:45.820
Well, let's go ahead and just make a slate color structure.

08:45.820 --> 08:47.410
So make slate color.

08:47.680 --> 08:51.120
And what color do we want for a blocked hit?

08:51.130 --> 08:56.350
I'm going to make it something like a light blue, something like that.

08:56.500 --> 08:57.850
Just like that.

08:57.880 --> 09:08.360
Now, in the case that this branch fails, then that means that either is block is false or is crit

09:08.360 --> 09:08.810
is true.

09:08.810 --> 09:12.890
So let's check another one of the possible scenarios.

09:13.250 --> 09:15.950
So I'm going to have another branch after this one.

09:16.310 --> 09:18.980
And for this one, let's check the opposite.

09:18.980 --> 09:23.660
Case is block is not true and is crit is true.

09:24.050 --> 09:30.710
I'm going to go ahead and duplicate these nodes but I'm going to have is block passed into the not.

09:31.730 --> 09:34.910
Like that and is crit passed in directly to the ad?

09:34.940 --> 09:40.760
Now, at this point I have some red spaghetti going on that I don't like, so I'm going to promote.

09:40.760 --> 09:47.240
These two local variables I'm going to take is block promote to local variable called block.

09:47.240 --> 09:52.880
And I'm going to take is crit promote to local variable called crit.

09:54.560 --> 10:00.250
Now that I have these, I don't have to have all these wires because that's a nightmare.

10:00.260 --> 10:02.900
So is Block goes in here.

10:03.690 --> 10:09.330
It's actually blocked now and then is crit which is now crit goes in here.

10:10.270 --> 10:15.370
And then block is block went down into the not down here.

10:15.400 --> 10:24.970
Now it's just block and then is quit now is just quit down here now we're not creating so many nightmarish

10:24.970 --> 10:31.900
crisscrossing lines so this one goes into this branch and these branches should probably have comments

10:31.900 --> 10:32.920
so we know what's going on.

10:32.920 --> 10:44.680
So this one, I'll place a comment and say block, no crit looks good, and then this one will say crit,

10:45.040 --> 10:45.550
no.

10:45.550 --> 10:51.340
Block So if it's a critical hit, then I can set out color to a different color.

10:51.340 --> 10:53.850
So I'm going to duplicate this down here.

10:54.160 --> 10:56.200
Don't think I need the reroute.

10:57.550 --> 11:01.540
Move this out of the way and we're going to set the out color.

11:02.860 --> 11:06.520
If it's a critical hit, maybe to something reddish.

11:07.920 --> 11:09.630
Maybe even all red.

11:12.890 --> 11:14.060
Something like that.

11:14.680 --> 11:16.060
So that's a critical hit.

11:17.550 --> 11:22.980
Now we can have a false case for this because we could have both.

11:23.190 --> 11:26.460
So if that's the case, we're going to have one more branch.

11:29.890 --> 11:33.020
And this will be for when both of these are true.

11:33.040 --> 11:38.560
So I'm going to duplicate the and duplicate block duplicate crit.

11:38.980 --> 11:41.830
And this will be for a blocked critical hit.

11:41.860 --> 11:43.600
We can choose a color for that as well.

11:43.600 --> 11:45.580
So hooking that up.

11:46.000 --> 11:48.400
I'll go ahead and duplicate these nodes.

11:48.520 --> 11:53.230
And for a blocked critical hit, I think I'd like something yellow, perhaps.

11:53.230 --> 11:54.010
Block.

11:54.370 --> 11:54.940
Blocked.

11:54.940 --> 11:55.480
Critical hit.

11:55.480 --> 11:56.440
Something like this.

11:56.440 --> 11:58.900
Color, I think, is fine.

12:00.430 --> 12:06.670
And there is yet another scenario, which is when we don't have a block and we don't have a critical

12:06.700 --> 12:07.600
hit either.

12:07.600 --> 12:10.120
So that's going to be for our last case.

12:10.120 --> 12:18.550
This one should get a comment, though, that says block and crit and then we'll have another one for

12:18.550 --> 12:20.200
the last false case.

12:20.200 --> 12:30.280
This one is going to be no block, no crit, and it's really just the else case, right?

12:30.280 --> 12:35.050
But we can just go ahead and check these conditions anyway.

12:36.740 --> 12:38.480
We can have two knots here.

12:40.290 --> 12:43.140
And we can have block and crit.

12:43.170 --> 12:44.640
We can just check these.

12:44.670 --> 12:48.870
We don't have to, though, because this is just the remaining case.

12:48.900 --> 12:54.270
We don't have to even have a last branch here, but we'll just do it anyway.

12:54.480 --> 12:58.140
And for no block, no crit, let's just make this white.

13:00.570 --> 13:03.750
And we'll just put them both here.

13:05.360 --> 13:11.150
Okay, so all of these scenarios must go into the return node.

13:11.540 --> 13:17.750
So up here this setter goes to the return node and so do all the others.

13:17.750 --> 13:20.960
So they'll all go to the return node.

13:20.960 --> 13:28.340
And when we reach the return node, we'll return out color, which is set in all the different scenarios

13:28.340 --> 13:28.940
here.

13:29.300 --> 13:30.170
Okay.

13:30.170 --> 13:33.080
So I'm just going to really quickly.

13:34.510 --> 13:36.850
Organize this as best I can.

13:49.750 --> 13:50.230
Okay.

13:50.230 --> 13:52.940
I think that's looking pretty good.

13:52.960 --> 13:54.960
So we have block no crit.

13:54.970 --> 14:02.920
That's blue crit, no block That's red block and crit, which is a kind of bone yellow color and no

14:02.920 --> 14:04.830
block no crit, which is white.

14:04.840 --> 14:06.940
And this function returns a color.

14:06.940 --> 14:11.200
So let's go ahead and just save and go back to update damage.

14:11.200 --> 14:12.940
And we can call this function.

14:12.940 --> 14:14.320
So I'm going to call it.

14:14.320 --> 14:18.910
It's just get color based on block and crit.

14:18.940 --> 14:22.090
We're going to pass in block and crit directly in.

14:22.920 --> 14:24.930
Blocked, hit, hit, hit.

14:25.020 --> 14:27.990
And I'll move this out of the way here.

14:31.720 --> 14:38.470
And we'll just go ahead and promote color to a local variable called text color.

14:40.260 --> 14:42.000
That way we have that.

14:42.000 --> 14:47.010
And after setting the text, we can set the text color as well.

14:47.040 --> 14:53.370
So I'm going to take text damage, duplicate it and call set color and opacity.

14:53.640 --> 15:00.030
And this takes in a slate color structure so we can pass in text color.

15:00.040 --> 15:05.730
I'm going to grab that, get it, set it there and that's it.

15:06.450 --> 15:08.580
So this function gives us the color.

15:08.580 --> 15:12.540
Since we're setting the color, we can see if we get a block or a crit.

15:12.810 --> 15:15.690
Last step is to test it.

15:16.530 --> 15:18.660
So let's just cause some damage.

15:19.110 --> 15:19.740
Look at that.

15:19.740 --> 15:21.030
We got a blocked hit.

15:21.060 --> 15:23.310
We can tell because it's blue.

15:23.310 --> 15:31.410
And I'm just now realizing we're only going to get blocked hits because we set the block chance to 100

15:31.410 --> 15:31.950
for these guys.

15:31.950 --> 15:38.880
So I'm going to go back to Blueprints Ability system go to gameplay effects, default attributes.

15:38.880 --> 15:46.860
We got the test secondary attributes here and let's just set the block chance to oh 50%.

15:48.510 --> 15:54.220
And as we know, our Aura character only has a critical hit chance of three.

15:54.240 --> 16:01.800
So it might be a good opportunity now to tweak the relationship between critical hit chance and its

16:01.800 --> 16:03.270
backing attributes.

16:04.530 --> 16:05.820
So we can do that as well.

16:05.820 --> 16:07.860
But let's just cause damage a couple times.

16:07.860 --> 16:10.710
There's a four, there's an eight, and it was white.

16:10.710 --> 16:13.680
Look at that, eight four.

16:13.800 --> 16:17.730
So we're getting some blocked hits, some non blocked hits.

16:17.760 --> 16:19.890
We haven't gotten any critical hits yet.

16:20.890 --> 16:25.780
So I think it's a good opportunity now to make a couple changes.

16:25.780 --> 16:33.580
For one, let's just take a look at aura and secondary attributes and just scroll down to our critical

16:33.610 --> 16:35.110
hit Chance.

16:35.900 --> 16:36.650
Here it is.

16:36.680 --> 16:43.850
It's based on armor penetration and it's got a post-multiply additive value of two.

16:44.120 --> 16:46.850
We could raise that to say ten.

16:47.060 --> 16:53.480
And for every armor penetration point, it looks like we get 0.25 points added.

16:53.690 --> 16:55.730
We could change that to 0.5.

16:55.940 --> 16:59.660
And we can also go look at armor penetration.

16:59.900 --> 17:02.850
Armor penetration is up here.

17:02.870 --> 17:09.950
It's based on resilience and it has a post multiply additive value of three, but we can change that

17:09.950 --> 17:11.240
to say seven.

17:11.540 --> 17:19.010
And for every resilience point we have one added to it and then the coefficient is 0.15.

17:19.040 --> 17:22.230
I think actually adding seven to it is going to increase it quite a bit.

17:22.250 --> 17:23.720
Let's just see.

17:23.840 --> 17:29.540
Critical hit chance is now 14, but we could make that even higher if we'd like.

17:30.210 --> 17:39.270
So we can make armor penetration higher by giving it let's give it about a 25 base value.

17:40.190 --> 17:42.410
Now critical hit chance is 23.

17:42.590 --> 17:46.670
I think that's a good enough chance that we should see at least a couple critical hits.

17:46.910 --> 17:48.340
That was a blocked hit.

17:48.350 --> 17:49.380
Blocked hit.

17:49.400 --> 17:51.590
Oh, that was a blocked critical hit.

17:51.620 --> 17:54.410
I saw 54 in a bone, white color.

17:55.500 --> 17:58.080
There was a critical hit there, 63.

17:59.660 --> 18:01.330
Now, this is quite a contrast.

18:01.340 --> 18:08.270
A blockhead is only four and a blocked crit is 54 and then a non blocked critical hit is pretty high.

18:08.300 --> 18:09.290
63.

18:09.530 --> 18:10.460
That's fine.

18:10.460 --> 18:13.760
These are values that we can always tweak with testing.

18:13.760 --> 18:19.790
But the important part is that we're seeing all of those and we're getting visual feedback in the form

18:19.790 --> 18:20.660
of colors.

18:21.080 --> 18:22.460
So this is great.

18:22.490 --> 18:24.650
This is a great milestone.

18:24.650 --> 18:31.280
But the thing about this is that colors are not all that informative.

18:31.310 --> 18:37.760
They do tell us that something is different, but new players to the game are not necessarily going

18:37.760 --> 18:41.240
to know what a red number is, what a blue number is.

18:41.510 --> 18:47.300
It's also good to show them either a symbol or a message that says what's going on.

18:47.300 --> 18:53.180
So in the case of blocked damage, we could have a message here that says block In the case of a critical

18:53.180 --> 18:54.890
hit, we can say critical hit.

18:54.890 --> 18:59.370
And if it's neither of those, well, we could just have no message.

18:59.370 --> 19:05.760
So I think it would be a good idea to show a message when we have a block, when we have a crit, when

19:05.760 --> 19:10.440
we have both, and we can perhaps animate that message.

19:10.440 --> 19:14.640
So it looks nice on the screen when we're engaging in combat.

19:14.850 --> 19:18.320
So that is the next thing that I'd like to take care of.

19:18.330 --> 19:20.190
We'll do that in the next video.

19:20.190 --> 19:22.830
So excellent job and I'll see you soon.
