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,380
In this lesson, we're going to create our first enemy, which is the crab.
2
00:00:03,380 --> 00:00:07,700
Just to refresh our memory, we already created this BP action char base.
3
00:00:07,700 --> 00:00:09,380
We created the BP player.
4
00:00:09,380 --> 00:00:15,050
But now we first want to create the BP enemy base, which is going to be used for all of the other enemies
5
00:00:15,050 --> 00:00:16,100
as a parent.
6
00:00:16,100 --> 00:00:19,880
And later on, this is going to have a D spawn function turn character function.
7
00:00:19,880 --> 00:00:23,210
And in this episode we're also going to create the enemy crab.
8
00:00:23,210 --> 00:00:25,760
The bad lizard and I are going to happen later.
9
00:00:25,760 --> 00:00:30,110
But yeah, now we create the base and we also create the crab.
10
00:00:30,750 --> 00:00:34,080
Let's open up the content drawer under blueprints.
11
00:00:34,080 --> 00:00:35,040
Characters.
12
00:00:35,040 --> 00:00:40,050
We have the Action Jar base, which is going to be the parent of our enemy base, so we can just right
13
00:00:40,050 --> 00:00:43,650
click and create Child Blueprint class.
14
00:00:43,650 --> 00:00:48,360
And this is going to be BP enemy underscore base.
15
00:00:49,350 --> 00:00:56,700
And I'm going to create a new folder, a new folder, just call it enemies and drag this in here.
16
00:00:56,700 --> 00:00:58,470
Move here okay.
17
00:00:58,470 --> 00:01:02,340
So this is the parent which is going to be shared between all of the enemies.
18
00:01:02,340 --> 00:01:06,690
And for now we're not going to put anything in here specifically, but we just want to have it in our
19
00:01:06,690 --> 00:01:07,860
inheritance chain.
20
00:01:07,860 --> 00:01:13,980
And now we can create a child blueprint from this, which is going to be the BP enemy crab.
21
00:01:14,160 --> 00:01:17,250
And we want to open up this BP enemy crab.
22
00:01:17,930 --> 00:01:19,220
And drag it over here.
23
00:01:19,250 --> 00:01:21,800
Get rid of this and this and.
24
00:01:21,800 --> 00:01:23,660
Yeah, for now, this just looks like our player.
25
00:01:23,660 --> 00:01:25,460
It doesn't really look much like a crab.
26
00:01:25,460 --> 00:01:27,740
So this is the first thing we want to take care of.
27
00:01:28,160 --> 00:01:29,600
We can go to the sprite.
28
00:01:29,600 --> 00:01:32,960
And here we just look for crab idle.
29
00:01:34,200 --> 00:01:35,820
And this already looks a lot better.
30
00:01:35,820 --> 00:01:38,400
But we need to adjust the capsule.
31
00:01:38,760 --> 00:01:42,300
We can go to the capsule component and we want to change the half height.
32
00:01:42,300 --> 00:01:44,460
So I can just drag here and kind of see.
33
00:01:44,640 --> 00:01:48,000
And I think like 45 is good for this.
34
00:01:48,000 --> 00:01:50,730
But we also want to make the radius a little bit bigger.
35
00:01:50,730 --> 00:01:53,010
So again also use 45.
36
00:01:53,010 --> 00:01:55,800
We cannot have a bigger radius than height right.
37
00:01:55,800 --> 00:01:57,840
Like even if I drag you see it doesn't work out.
38
00:01:57,840 --> 00:01:59,250
So it's kind of round.
39
00:01:59,250 --> 00:02:00,690
It's almost like a sphere now.
40
00:02:00,690 --> 00:02:02,880
But this is good for the crab.
41
00:02:02,880 --> 00:02:06,030
And you might think this isn't very accurate because the hands are out of the sphere.
42
00:02:06,060 --> 00:02:08,729
You sometimes don't want everything to be inside the collision.
43
00:02:08,729 --> 00:02:10,949
It's better just the main body is in here.
44
00:02:10,949 --> 00:02:15,660
And these are just kind of appendages that are sticking out that don't have collision on them.
45
00:02:15,660 --> 00:02:20,160
We then also want to make sure that the sprite is in the middle, because here we set it to minus five
46
00:02:20,160 --> 00:02:21,150
for the player.
47
00:02:21,150 --> 00:02:22,530
You can set it to zero.
48
00:02:22,530 --> 00:02:23,910
Now it's in the middle here.
49
00:02:23,910 --> 00:02:28,260
And we again want to use our trick to align the feet to the ground.
50
00:02:28,530 --> 00:02:30,120
And now this is almost fitting.
51
00:02:30,120 --> 00:02:34,170
So we can just go in here and drag the crab in here.
52
00:02:34,170 --> 00:02:36,660
And again we make sure to start the game.
53
00:02:37,490 --> 00:02:41,240
And we then eject and we can just zoom here.
54
00:02:41,270 --> 00:02:46,700
You can use the scroll wheel to change the zoom speed, and you can see that our feet are inside of
55
00:02:46,700 --> 00:02:47,330
the floor.
56
00:02:47,330 --> 00:02:52,100
So again we can select the enemy crab, go to details the sprite.
57
00:02:52,100 --> 00:02:56,900
And here we can now drag it up and down and see what is a good value.
58
00:02:59,200 --> 00:03:02,110
17 looks about right, but it's not perfect.
59
00:03:02,110 --> 00:03:04,900
So we can maybe go for a 16.8.
60
00:03:04,900 --> 00:03:08,740
And yeah, now this looks perfectly aligned with the floor.
61
00:03:08,740 --> 00:03:10,570
So we can just copy this value.
62
00:03:11,590 --> 00:03:13,030
Exit out here and in the enemy.
63
00:03:13,030 --> 00:03:14,410
Grab on the sprite.
64
00:03:14,410 --> 00:03:15,910
Just paste this in here.
65
00:03:15,910 --> 00:03:18,340
And now we have the perfect position.
66
00:03:19,190 --> 00:03:23,060
Now we do want to keep the crab in the map so we can test things out.
67
00:03:23,060 --> 00:03:26,840
But you remember that we locked all of our characters on this axis.
68
00:03:26,840 --> 00:03:31,700
So if the crab is too much in the background, we are going to have a hard time interacting with it.
69
00:03:31,700 --> 00:03:36,710
So we can just go to the player start and we can see that the Y is zero.
70
00:03:36,710 --> 00:03:40,190
So we can also just go to the crab and set the Y to zero.
71
00:03:40,190 --> 00:03:42,800
So now we know they exist on the same lane.
72
00:03:42,800 --> 00:03:44,690
And we can just like test interactions.
73
00:03:44,690 --> 00:03:45,110
Right.
74
00:03:45,110 --> 00:03:49,370
So you can see the crab is now blocking us which is something we're going to change later.
75
00:03:49,370 --> 00:03:50,990
But for now this is fine.
76
00:03:51,870 --> 00:03:55,500
And also like this interaction is weird, like we just hover on top of it.
77
00:03:55,500 --> 00:03:56,490
We don't want that.
78
00:03:56,490 --> 00:03:58,680
And we're going to change the collision settings here.
79
00:03:59,240 --> 00:04:02,660
And some issue you might get if you walk towards the crab.
80
00:04:02,660 --> 00:04:07,700
It is not happening for me right now, but it did happen during my prototyping is that you get some
81
00:04:07,700 --> 00:04:13,160
flickering if the crab's claws on top of the player, because the game doesn't know what it should show
82
00:04:13,160 --> 00:04:15,650
in the foreground and what it should show in the background.
83
00:04:15,650 --> 00:04:20,180
And a very simple trick for this is to just go to the player blueprint.
84
00:04:20,180 --> 00:04:21,170
Characters.
85
00:04:21,170 --> 00:04:23,450
Player BP player.
86
00:04:24,000 --> 00:04:30,660
And, uh, go to the sprite and we just want to move the sprite very slightly in the foreground.
87
00:04:31,200 --> 00:04:35,220
And really just a 0.05.
88
00:04:35,220 --> 00:04:38,970
You can't even see it, but it is a little bit in the foreground.
89
00:04:39,240 --> 00:04:43,890
And if we play now, well, you can see that we are in front of the hand.
90
00:04:43,890 --> 00:04:46,920
If we walk right and we are behind the hand if we walk left.
91
00:04:46,920 --> 00:04:50,850
And I think this is just a really cool, simple effect that we can put in.
92
00:04:50,940 --> 00:04:55,710
And this prevents issues with the zuHause or flickering issue that we have many times with these kind
93
00:04:55,710 --> 00:04:56,400
of sprites.
94
00:04:57,570 --> 00:05:01,170
The next thing you want to take care of is actually being able to shoot the crab.
95
00:05:01,170 --> 00:05:04,110
Because now if I shoot, the bullet just flies through the crab.
96
00:05:04,110 --> 00:05:06,990
So first we just want to detect the event.
97
00:05:06,990 --> 00:05:09,960
If we hit the crab and then see what we can do from that.
98
00:05:09,960 --> 00:05:15,720
So in the content drawer we want to go to blueprints uh projectiles.
99
00:05:16,300 --> 00:05:20,980
And go to the projectile base, because this is an overarching thing we want to have for all of the
100
00:05:20,980 --> 00:05:24,280
projectiles to check for an enemy or a player.
101
00:05:24,280 --> 00:05:28,630
If we go to the sphere, we can again scroll to our collision settings.
102
00:05:28,630 --> 00:05:29,140
Right.
103
00:05:29,140 --> 00:05:31,000
And you see that here we have projectile.
104
00:05:31,000 --> 00:05:32,950
We are overlapping with the pawn.
105
00:05:32,950 --> 00:05:34,750
So this is already set up correctly.
106
00:05:34,750 --> 00:05:38,350
The collision channel is but we're just not listening to the event.
107
00:05:38,350 --> 00:05:43,300
So we are listening to the hit event which happens if two blocking objects hit each other.
108
00:05:43,300 --> 00:05:47,050
But we are not listening to the on component begin overlap.
109
00:05:47,050 --> 00:05:49,930
And this is if we overlap with something.
110
00:05:49,930 --> 00:05:52,750
So we can just go here and add the event in here.
111
00:05:52,750 --> 00:05:59,350
And for now well we can just print string first print string like this and print the other actor.
112
00:05:59,350 --> 00:06:02,290
So this shows what are we actually hitting with this bullet.
113
00:06:02,290 --> 00:06:03,730
So I can just go here.
114
00:06:03,940 --> 00:06:07,870
And the first thing you see is that we collide with ourselves first.
115
00:06:08,900 --> 00:06:13,280
And this makes sense because the bullet doesn't really know who it's supposed to collide with, and
116
00:06:13,280 --> 00:06:14,960
we spawned it inside of the character.
117
00:06:14,990 --> 00:06:19,370
So yeah, this is something we'll have to take care of to not deal damage to ourselves.
118
00:06:19,370 --> 00:06:23,570
But also we can see that the crap is being printed if we shoot the crap.
119
00:06:23,570 --> 00:06:25,130
So this is the first step.
120
00:06:25,950 --> 00:06:31,920
Back in the projectile base, we first want to check if the other actor is a character.
121
00:06:31,920 --> 00:06:37,950
So action star we can cast to action char because there could be other things we can overlap with.
122
00:06:37,950 --> 00:06:42,300
So other projectiles, other things, other decorations in the stage.
123
00:06:42,300 --> 00:06:47,490
And we don't want to destroy the projectile in that case, we only want to destroy it and do something
124
00:06:47,490 --> 00:06:51,600
either if we hit the wall or something hard, or if we hit an action shot.
125
00:06:51,600 --> 00:06:53,520
So the player or an enemy.
126
00:06:53,520 --> 00:06:58,140
For now, we just want to destroy the enemy right away without worrying about health and things like
127
00:06:58,140 --> 00:06:58,500
that.
128
00:06:58,500 --> 00:07:04,350
So we can cast and this is the enemy or the player we hit and we can just call destroy actor for now.
129
00:07:04,350 --> 00:07:06,780
And this is going to cause an issue for now that I want to show you.
130
00:07:06,780 --> 00:07:07,020
Right.
131
00:07:07,020 --> 00:07:10,890
So if I do this, we just destroy ourselves if we shoot ourselves.
132
00:07:10,890 --> 00:07:12,360
So this is not what we want.
133
00:07:12,360 --> 00:07:13,920
But this is the first step.
134
00:07:14,340 --> 00:07:20,130
An easy solution we could use here is to just instead of casting to action shot, we can cast to enemy
135
00:07:20,130 --> 00:07:21,150
base.
136
00:07:21,300 --> 00:07:23,880
This encompasses all of our enemies, right?
137
00:07:23,880 --> 00:07:25,920
So if we just do this instead.
138
00:07:26,620 --> 00:07:29,260
We do this right, we can shoot.
139
00:07:29,260 --> 00:07:32,320
We don't destroy ourselves, but we destroy the enemy.
140
00:07:32,320 --> 00:07:34,660
And this is a very common way of doing this.
141
00:07:34,660 --> 00:07:37,090
But because we are using inheritance, right?
142
00:07:37,090 --> 00:07:38,920
This is the projectile base.
143
00:07:38,920 --> 00:07:43,750
These nodes should be made in a modular manner that also works for the projectile of the lizard.
144
00:07:43,750 --> 00:07:47,950
So if we do this, it's going to work for our player projectiles, but it's not going to work for the
145
00:07:47,950 --> 00:07:48,640
lizard.
146
00:07:48,820 --> 00:07:54,220
So we could just redo all of this in our children and make sure that in the case it's a player, we
147
00:07:54,250 --> 00:07:54,910
cast the enemy.
148
00:07:54,910 --> 00:07:59,350
In the case it's an enemy, we cast the player and that works fine, but it's a little bit convoluted.
149
00:07:59,350 --> 00:08:01,660
There's actually a better solution for this.
150
00:08:01,990 --> 00:08:05,830
So now we just want to go back to casting to action char and use this.
151
00:08:05,830 --> 00:08:09,040
Get rid of this one and just compile and save.
152
00:08:09,040 --> 00:08:12,220
And we just want to add a faction check in here.
153
00:08:13,240 --> 00:08:18,880
And this is just a simple system that I like using a lot because it's very simple, but it is expandable
154
00:08:18,880 --> 00:08:20,110
and versatile.
155
00:08:20,880 --> 00:08:26,160
You simply assign factions to certain characters so you could have faction zero is the players, faction
156
00:08:26,160 --> 00:08:31,560
one is the enemies, and maybe you could have even more factions like different tribes.
157
00:08:31,560 --> 00:08:35,880
So maybe wildlife is faction two and maybe the wildlife fight against the enemies.
158
00:08:35,880 --> 00:08:39,059
And it's just a very simple system, but it is expandable.
159
00:08:39,510 --> 00:08:45,390
So on the action char we can go back to the blueprints characters, action char.
160
00:08:45,390 --> 00:08:48,360
And here I want to implement the faction system.
161
00:08:48,360 --> 00:08:51,180
So the easiest way of doing this is to just go to variables.
162
00:08:51,180 --> 00:08:53,100
And we just call faction.
163
00:08:53,220 --> 00:08:56,100
And we make sure to select an integer.
164
00:08:56,100 --> 00:08:56,730
Right.
165
00:08:56,730 --> 00:08:59,820
So then I could say well the default is zero.
166
00:08:59,820 --> 00:09:00,900
So the player is zero.
167
00:09:00,930 --> 00:09:04,200
I could then go into the enemy base and make it one for the enemies.
168
00:09:04,200 --> 00:09:12,180
And then in the projectile I could check for the faction and only apply damage or only destroy the actor
169
00:09:12,180 --> 00:09:13,710
if it's a different faction.
170
00:09:15,420 --> 00:09:20,400
But it can be quite hard to keep track of this with an integer, because we might forget what was the
171
00:09:20,400 --> 00:09:22,770
player one, or was the player zero.
172
00:09:22,770 --> 00:09:23,910
And it works.
173
00:09:23,910 --> 00:09:30,390
But it is hard to manage the system, and this is a perfect use case for an enum or an enumerator.
174
00:09:31,250 --> 00:09:35,900
So I will show you how we can easily create an enum so we can go to the content drawer.
175
00:09:36,500 --> 00:09:40,850
Under blueprints, make a new folder and just called enums.
176
00:09:41,550 --> 00:09:42,420
In here.
177
00:09:42,420 --> 00:09:44,700
Just right click go to blueprint.
178
00:09:44,700 --> 00:09:46,980
And here we have an enumeration.
179
00:09:46,980 --> 00:09:52,380
And here we want to call it E underscore faction and open it up.
180
00:09:52,530 --> 00:09:55,320
And we can add two enumerators.
181
00:09:55,320 --> 00:09:59,070
And what this is it basically just tags a number.
182
00:09:59,070 --> 00:10:05,100
So instead of us having to remember zero and one we can just tag the zero as player and we can tag one
183
00:10:05,100 --> 00:10:06,210
as the enemies.
184
00:10:06,630 --> 00:10:09,480
So here for display name we can just put player.
185
00:10:09,720 --> 00:10:12,300
And for the second one we can just put an enemy.
186
00:10:13,350 --> 00:10:15,270
And just save this.
187
00:10:15,510 --> 00:10:21,540
And inside of the action jar base, we want to compile save to make sure the enum is being loaded.
188
00:10:21,540 --> 00:10:25,560
And here instead of integer we can just look for E faction.
189
00:10:27,050 --> 00:10:28,670
And compile and save.
190
00:10:28,760 --> 00:10:32,180
And we can just let the default value as player.
191
00:10:32,180 --> 00:10:38,540
This is fine, but we then want to go into our blueprints, characters, enemies.
192
00:10:38,540 --> 00:10:44,420
And here again it's very good that we have this overarching BP enemy base because we want to change
193
00:10:44,420 --> 00:10:45,650
this on every enemy.
194
00:10:45,650 --> 00:10:47,300
We can just open this up.
195
00:10:47,300 --> 00:10:52,220
And here you actually cannot see the faction here because it's inherited.
196
00:10:52,220 --> 00:10:54,470
We find it though in the details panel here.
197
00:10:54,470 --> 00:10:57,230
So here we can just look for faction.
198
00:10:57,810 --> 00:11:00,150
And here you see the default value for faction.
199
00:11:00,870 --> 00:11:06,450
And since this is the enemy base, we just set this to enemy and compile and save, right?
200
00:11:06,450 --> 00:11:12,330
So we created a variable here on the action jar base, and it's being passed down to the enemy base
201
00:11:12,330 --> 00:11:13,410
because it's a child.
202
00:11:13,410 --> 00:11:16,560
And then here in the details panel also you don't have to search for it.
203
00:11:16,560 --> 00:11:18,510
You can just scroll down to default.
204
00:11:18,510 --> 00:11:20,700
And here in default it's always going to show up.
205
00:11:20,700 --> 00:11:23,580
And we can just overwrite the value on each child.
206
00:11:23,580 --> 00:11:29,850
One problem now though, is that only our action char has a faction, but the projectile itself does
207
00:11:29,850 --> 00:11:31,140
not have a faction.
208
00:11:31,140 --> 00:11:33,930
The projectile also needs to know about these factions.
209
00:11:33,930 --> 00:11:39,780
So one thing we could do in the projectile base is we could for the hit character, well, we can get
210
00:11:39,780 --> 00:11:45,360
faction, right, we can get the faction here and we can also get owner.
211
00:11:46,180 --> 00:11:49,330
And we could then cast the owner to action star to all of this.
212
00:11:49,330 --> 00:11:54,880
But the problem here is that we could shoot a bullet and the owner of the bullet might be destroyed
213
00:11:54,880 --> 00:11:57,310
while the bullet is still active and before hitting something.
214
00:11:57,310 --> 00:12:02,230
So if we try to get the faction from the owner, this is not going to work and it's going to cause crashes
215
00:12:02,230 --> 00:12:03,790
and bugs in some cases.
216
00:12:04,240 --> 00:12:08,650
The other action was always going to be available while we hit it, so we can get the faction from here.
217
00:12:08,650 --> 00:12:14,710
This is not a problem, but we actually want to save the faction on the projectile when it's being,
218
00:12:14,710 --> 00:12:17,140
uh, when it's being created.
219
00:12:17,140 --> 00:12:19,570
So in here we can create another variable.
220
00:12:19,570 --> 00:12:24,220
And here it's also just going to be faction and also of E faction.
221
00:12:27,840 --> 00:12:29,490
And yes, we can change the variable type.
222
00:12:29,490 --> 00:12:30,210
It's fine.
223
00:12:30,210 --> 00:12:31,980
It's not going to overwrite anything.
224
00:12:32,220 --> 00:12:33,210
Uh, just compile and save.
225
00:12:33,210 --> 00:12:35,310
And now we have the faction inside of here.
226
00:12:35,990 --> 00:12:40,580
So what we can do here is now we just set the faction by default to enemy.
227
00:12:41,060 --> 00:12:45,770
So if we don't change anything, this projectile is going to be treated as an enemy projectile.
228
00:12:45,770 --> 00:12:49,850
But we already prepared on the player projectile.
229
00:12:49,850 --> 00:12:50,090
Right.
230
00:12:50,090 --> 00:12:50,690
Blueprints.
231
00:12:50,690 --> 00:12:51,560
Projectiles.
232
00:12:51,560 --> 00:12:52,520
Player.
233
00:12:52,760 --> 00:12:54,320
The player projectile.
234
00:12:54,320 --> 00:12:55,040
Base.
235
00:12:56,330 --> 00:13:01,670
We already set up this whole thing on Beginplay, right where we get the owner, we cast it to player.
236
00:13:01,670 --> 00:13:05,510
So what we can do here now is, well, we can just get the owning player here.
237
00:13:05,510 --> 00:13:06,920
We can just get faction.
238
00:13:08,030 --> 00:13:09,410
And here now the player projectile.
239
00:13:09,410 --> 00:13:11,810
We just want to make sure that it is compiled and saved.
240
00:13:11,810 --> 00:13:17,990
And here we can just set faction and it's going to show variables default set faction.
241
00:13:18,110 --> 00:13:20,090
And we can just select it from the menu here.
242
00:13:20,090 --> 00:13:24,500
But no we just want to get the faction of the player and put it inside your in the projectile and compile
243
00:13:24,500 --> 00:13:25,130
and save.
244
00:13:26,980 --> 00:13:29,680
And this is all we need to save the faction, right?
245
00:13:29,680 --> 00:13:34,180
By default, it's going to be the enemy and we only override it in the player.
246
00:13:34,330 --> 00:13:40,120
So back in the projectile base, we can now use the faction of the hit character and compare it to the
247
00:13:40,120 --> 00:13:42,730
faction that is available on this projectile.
248
00:13:42,730 --> 00:13:43,210
Right.
249
00:13:43,210 --> 00:13:44,590
So we can get faction.
250
00:13:44,950 --> 00:13:51,610
And here we just want to check for not equal, but we actually want to use the not equal enum like this.
251
00:13:51,610 --> 00:13:53,110
And connect this one here as well.
252
00:13:53,110 --> 00:13:53,320
Right.
253
00:13:53,320 --> 00:13:55,240
So now it's going to compare these two.
254
00:13:55,360 --> 00:13:59,740
And only if they are not equal do we want to use a branch here.
255
00:14:01,040 --> 00:14:02,750
And continue.
256
00:14:03,330 --> 00:14:05,190
If this is true, right?
257
00:14:05,190 --> 00:14:10,830
So if the fraction of the projectile is the same fraction as the hit target, it's just going to do
258
00:14:10,830 --> 00:14:12,600
nothing because this is false.
259
00:14:13,160 --> 00:14:16,730
And if there are different factions, we're going to destroy the actor and we can just double click
260
00:14:16,730 --> 00:14:23,030
here to create some reroute nodes, make this a bit nicer to look at and more organized.
261
00:14:24,700 --> 00:14:26,950
And this is how we can handle a case like this.
262
00:14:26,950 --> 00:14:28,300
Now let's just check it out.
263
00:14:28,300 --> 00:14:31,780
I don't hurt myself, but I can hurt the enemy.
264
00:14:31,780 --> 00:14:34,240
And later on, the enemy can also hurt me.
265
00:14:34,240 --> 00:14:36,520
And it's a very flexible system.
266
00:14:37,490 --> 00:14:42,620
We don't just want the hit enemy to disappear, though, we also want the projectile to disappear.
267
00:14:42,620 --> 00:14:43,640
So back here.
268
00:14:43,670 --> 00:14:45,200
BP projectile base.
269
00:14:45,230 --> 00:14:53,030
Now, when we destroy the actor, this actor, we also just want to call destroy actor again, which
270
00:14:53,030 --> 00:14:54,620
is on the projectile.
271
00:14:56,870 --> 00:14:59,780
So we can just compile and save right here.
272
00:15:00,450 --> 00:15:03,210
We destroy the enemy, the projectiles being destroyed.
273
00:15:03,210 --> 00:15:07,230
But we're not playing the effect of the projectile being destroyed.
274
00:15:07,230 --> 00:15:07,680
Right?
275
00:15:07,680 --> 00:15:09,960
So here again, we have this play hit effect.
276
00:15:09,960 --> 00:15:14,190
So we can just copy this, paste it in here before we destroy the projectile.
277
00:15:14,820 --> 00:15:16,200
We're just going to call this.
278
00:15:17,750 --> 00:15:18,170
Like this.
279
00:15:18,170 --> 00:15:20,150
And yeah, you can see the hit effect is being played.
280
00:15:20,150 --> 00:15:21,470
This is working fine.
281
00:15:21,950 --> 00:15:24,290
Now quickly we also want to add a particle effect.
282
00:15:24,290 --> 00:15:29,570
If the enemy is being destroyed we can just go to the content drawer and blueprints.
283
00:15:29,570 --> 00:15:31,760
We have the VFX blueprint right.
284
00:15:31,760 --> 00:15:32,840
This is the shot hit.
285
00:15:32,840 --> 00:15:33,920
This is the base.
286
00:15:33,920 --> 00:15:36,560
So you can just make a child of the base.
287
00:15:36,650 --> 00:15:41,210
And we're going to call BP VFX enemy destroyed.
288
00:15:42,190 --> 00:15:43,960
Like this and open it up.
289
00:15:43,960 --> 00:15:47,200
And the only thing we have to change here is the paper flip book.
290
00:15:47,200 --> 00:15:49,420
And I think it's called explosion.
291
00:15:49,420 --> 00:15:50,050
Yes.
292
00:15:50,050 --> 00:15:52,390
Explosion loop like this.
293
00:15:52,390 --> 00:15:56,710
And this is all we have to do because the parent already has the whole system implemented of this drawing
294
00:15:56,710 --> 00:15:58,510
the actor after playing one loop.
295
00:15:59,870 --> 00:16:02,510
Now in the enemy base.
296
00:16:02,510 --> 00:16:03,710
The enemy base.
297
00:16:03,710 --> 00:16:06,890
If you don't have it open, make sure to find it in the blueprints folder.
298
00:16:06,920 --> 00:16:13,760
We now want to go to Event Graph and here we can again use our old friend the destroyed event override.
299
00:16:13,760 --> 00:16:14,420
Right?
300
00:16:14,420 --> 00:16:20,180
So on destroyed we just want to spawn actor from class.
301
00:16:21,180 --> 00:16:26,370
And here we look for our VF, vfx, VFX enemy destroyed.
302
00:16:27,190 --> 00:16:29,260
We kind of split the struct pin here.
303
00:16:29,290 --> 00:16:31,600
Get actor location.
304
00:16:32,820 --> 00:16:35,790
And get actor rotation.
305
00:16:37,300 --> 00:16:39,670
And again, just make sure that always spawn.
306
00:16:39,670 --> 00:16:40,450
Ignore collision.
307
00:16:40,450 --> 00:16:44,590
We don't care about the instigator, owner and everything here and this is it.
308
00:16:44,590 --> 00:16:50,410
Just compile safe, start it up, I shoot the enemy and yeah, we get both of the explosion effects.
309
00:16:50,410 --> 00:16:54,670
There aren't any errors popping up, no reference issues and it just works out.
310
00:16:55,090 --> 00:16:58,660
But of course, not every enemy is supposed to be destroyed in a single hit.
311
00:16:58,660 --> 00:17:01,360
So in the next video, we're going to create a health system.
28521
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.