Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,140 --> 00:00:03,920
Now that the respawn at the checkpoints are working, you want to make sure that this also works.
2
00:00:03,920 --> 00:00:05,570
If we fall off the stage.
3
00:00:05,570 --> 00:00:09,290
If we just walk all the way to the right side now and fall down, nothing happens.
4
00:00:09,290 --> 00:00:14,450
We just keep on falling forever and ever and we need to implement a volume for that.
5
00:00:14,450 --> 00:00:19,070
That checks if the player falls down and then lets us respawn as well.
6
00:00:19,070 --> 00:00:25,070
There is actually already a system in Unreal Engine for this built in, and if you go to World settings,
7
00:00:25,070 --> 00:00:29,300
if you don't have world settings, you might have to click on window and open the world settings.
8
00:00:29,300 --> 00:00:33,500
Here you can see that there is a kill Z volume.
9
00:00:33,500 --> 00:00:36,620
And if let's say we put this to -100.
10
00:00:38,030 --> 00:00:40,910
I can then go over here and do the same thing.
11
00:00:42,500 --> 00:00:43,970
And now I fall down.
12
00:00:43,970 --> 00:00:45,740
The character is being destroyed.
13
00:00:45,770 --> 00:00:49,340
The problem with this system, though, is it doesn't give us control over anything.
14
00:00:49,340 --> 00:00:51,050
We don't get an event, we get nothing.
15
00:00:51,050 --> 00:00:52,310
The character is just gone.
16
00:00:52,310 --> 00:00:53,840
But that isn't what we want.
17
00:00:53,840 --> 00:00:57,290
We still want to have our entire thing with the screen fade and spawning the new character.
18
00:00:57,290 --> 00:00:57,470
Right?
19
00:00:57,470 --> 00:00:59,960
So this system is not good for this purpose.
20
00:01:00,350 --> 00:01:04,700
So just set it back to a really, really high number to make sure it doesn't take effect.
21
00:01:07,100 --> 00:01:12,110
Go to the content, draw to blueprints and props and here it is.
22
00:01:12,110 --> 00:01:14,450
Right click and create a new blueprint class.
23
00:01:14,450 --> 00:01:18,530
And this is also a basic actor because it's going to be a very simple blueprint.
24
00:01:18,530 --> 00:01:21,950
And it's called BP underscore fall detector.
25
00:01:21,950 --> 00:01:23,360
Then open it up.
26
00:01:24,910 --> 00:01:28,870
And in here, all we need is a box collision that checks for the player.
27
00:01:28,870 --> 00:01:33,460
And if the player falls in, we either just set it to defeat it or we apply damage.
28
00:01:33,670 --> 00:01:37,960
So here we can just add and we can look for box collision.
29
00:01:39,100 --> 00:01:44,080
Like this and we can just call trigger to make it more obvious what this is being used for.
30
00:01:44,080 --> 00:01:47,770
And then on the right side, if it's selected, go to the collision settings.
31
00:01:47,770 --> 00:01:50,890
And again we just want to set this to custom.
32
00:01:50,890 --> 00:01:55,090
Ignore everything and only check for the overlap with the pawn.
33
00:01:55,480 --> 00:01:59,770
Then we want to go to the on component Begin overlap event.
34
00:01:59,770 --> 00:02:00,610
Add this in.
35
00:02:00,610 --> 00:02:05,050
And as we've done a couple of times now, other actors cast to be player.
36
00:02:05,320 --> 00:02:10,030
So this only activates if the player is the one who is falling in here and here.
37
00:02:10,030 --> 00:02:12,280
We can then simply call apply damage.
38
00:02:13,330 --> 00:02:16,510
Apply damage to the player as the damaged actor.
39
00:02:16,840 --> 00:02:22,330
The damage causer should be ourself so we can just drag off here self which is the trigger volume.
40
00:02:22,420 --> 00:02:27,730
And then for the damage we can just put something really high just to make sure that the player is going
41
00:02:27,730 --> 00:02:29,410
to be defeated anyway.
42
00:02:29,560 --> 00:02:33,130
And this is just kind of a trick that many games use to have a shortcut.
43
00:02:33,130 --> 00:02:36,910
You don't have to make a custom system just to apply damage through a fall detector.
44
00:02:38,110 --> 00:02:39,850
And we can then just compile and save.
45
00:02:40,950 --> 00:02:43,800
And we want to drag it into the map.
46
00:02:43,800 --> 00:02:48,360
So here on the right side we just want to go here, drag in a fall detector.
47
00:02:48,510 --> 00:02:50,520
And we want to make it bigger.
48
00:02:50,520 --> 00:02:54,120
So not the actor itself but on the fall detector.
49
00:02:54,120 --> 00:02:54,570
Right.
50
00:02:54,570 --> 00:02:56,220
We can go to details.
51
00:02:56,220 --> 00:02:58,530
And here we have our trigger.
52
00:02:58,680 --> 00:03:01,110
And for the trigger box you can see the box extend here.
53
00:03:01,110 --> 00:03:01,980
And we can just drag.
54
00:03:01,980 --> 00:03:05,700
And you see it becomes bigger and also drag in this direction.
55
00:03:06,150 --> 00:03:07,770
And also a little bit like this.
56
00:03:07,770 --> 00:03:11,370
And now we can just place this somewhere in the world where you want to use it.
57
00:03:12,940 --> 00:03:16,990
Like this and make sure it kind of lines up with where the player is going to walk down.
58
00:03:16,990 --> 00:03:20,290
And you could make this so big that it covers the entire stage.
59
00:03:20,290 --> 00:03:24,760
That would be a good safety net, but we're going to use it more selectively.
60
00:03:24,760 --> 00:03:26,530
And let's try this out now.
61
00:03:26,530 --> 00:03:27,730
And I can go here.
62
00:03:28,400 --> 00:03:29,960
I can walk to the right side.
63
00:03:30,930 --> 00:03:35,880
And you can see we fall down, we apply damage, we kind of get bounced off and then the screen fades
64
00:03:35,880 --> 00:03:36,480
out.
65
00:03:36,570 --> 00:03:40,350
You might not like the bounce off animation, but actually think it looks kind of cool in this case
66
00:03:40,350 --> 00:03:40,650
as well.
67
00:03:40,650 --> 00:03:43,830
It doesn't make sense logically, but it again is more readable.
68
00:03:43,830 --> 00:03:48,090
It makes it very clear that we died, and later on we're not going to use this just on a hole.
69
00:03:48,090 --> 00:03:49,710
We're actually going to use this on lava.
70
00:03:49,710 --> 00:03:52,680
So it's going to start making more sense then as well.
71
00:03:52,830 --> 00:03:58,050
But you could make a special override to, let's say, if you use the fall detector to not play the
72
00:03:58,050 --> 00:04:00,570
knockback, but I like it, so I'll keep it in.
73
00:04:01,020 --> 00:04:06,600
And this is all there is to the fall detector and detecting if an enemy steps into lava or falls down
74
00:04:06,600 --> 00:04:07,260
a hole.
75
00:04:07,260 --> 00:04:10,230
In the next video, we're going to create our first enemy AI.
7084
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.