Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,080 --> 00:00:04,460
In this lesson, we're going to create a stationary enemy that just keeps on shooting projectiles.
2
00:00:04,490 --> 00:00:07,730
Let's first start out by making the lizard blueprint.
3
00:00:08,060 --> 00:00:14,180
As we have established in the beginning, the BPM lizard is going to be based on the BPM base, which
4
00:00:14,180 --> 00:00:17,300
then again is going to be based on the BP action chart base.
5
00:00:17,300 --> 00:00:22,430
So all of the paper XRD settings, parameters, health, all of this is going to be passed down here.
6
00:00:22,430 --> 00:00:24,290
And the turn character function is on here too.
7
00:00:24,290 --> 00:00:26,390
But I don't think we're going to use it for the lizard.
8
00:00:26,390 --> 00:00:31,250
And then all of the other stuff and the shoot interval system is going to be on the lizard itself,
9
00:00:31,250 --> 00:00:32,990
which we're going to create in this lesson.
10
00:00:32,990 --> 00:00:35,420
First, we can just close everything down here.
11
00:00:35,420 --> 00:00:42,290
Just close tabs to the right, go to the content, draw blueprints characters enemies and right click
12
00:00:42,290 --> 00:00:43,610
the BP enemy base.
13
00:00:43,610 --> 00:00:46,460
And here just create Child Blueprint class.
14
00:00:46,460 --> 00:00:49,940
And I'm just going to call BP Enemy Lizard.
15
00:00:51,170 --> 00:00:52,430
And open it up.
16
00:00:52,430 --> 00:00:55,070
And now we just want to go to the sprite.
17
00:00:55,070 --> 00:00:57,050
And here select the lizard.
18
00:00:57,950 --> 00:00:58,730
Idol.
19
00:00:59,820 --> 00:01:01,020
Just like this.
20
00:01:01,980 --> 00:01:05,459
And as always, we want to adjust the capsule collision slightly.
21
00:01:05,489 --> 00:01:05,940
Right.
22
00:01:05,940 --> 00:01:11,430
So in this case again we want to go to the capsule and we can make it smaller like this.
23
00:01:11,670 --> 00:01:13,680
So around 45.
24
00:01:14,770 --> 00:01:16,420
And then put it in the level.
25
00:01:17,970 --> 00:01:18,390
Like this.
26
00:01:18,390 --> 00:01:26,700
Just drag out one here on top of these boxes and make sure it is -50 on the y axis.
27
00:01:28,310 --> 00:01:30,260
I just mistyped -50.
28
00:01:31,330 --> 00:01:31,990
And yeah.
29
00:01:31,990 --> 00:01:33,940
So now you can see it is on top here.
30
00:01:33,940 --> 00:01:36,850
We want to turn it around so it shoots towards the player.
31
00:01:36,850 --> 00:01:41,350
So we can just go to rotate mode and rotate around by 180 degrees.
32
00:01:43,870 --> 00:01:52,030
And now we can just start the game, we can simulate and we can zoom in here and see that now the sprite
33
00:01:52,030 --> 00:01:53,560
is actually inside of the floor.
34
00:01:53,560 --> 00:01:56,080
So we again want to adjust the position slightly.
35
00:01:56,080 --> 00:01:59,380
So on the enemy lizard we can just go to the sprite.
36
00:01:59,380 --> 00:02:01,930
And here just drag around a little bit.
37
00:02:03,460 --> 00:02:05,230
And this looks about right.
38
00:02:05,260 --> 00:02:07,510
A little bit more to the bottom.
39
00:02:10,139 --> 00:02:12,750
So I think about 16.5.
40
00:02:12,780 --> 00:02:15,270
Yeah 16.5 looks like the right value.
41
00:02:15,270 --> 00:02:16,590
So we can just copy this.
42
00:02:16,860 --> 00:02:17,970
Exit out of the game.
43
00:02:17,970 --> 00:02:20,190
Go to the sprite on the lizard.
44
00:02:20,190 --> 00:02:23,280
And here just paste in 16.5.
45
00:02:23,280 --> 00:02:26,340
And now it's going to have the right height here.
46
00:02:26,670 --> 00:02:32,820
And now if we go to selected viewport we can see that everything works for the lizard right.
47
00:02:33,030 --> 00:02:34,920
We can take damage from the lizard.
48
00:02:34,920 --> 00:02:36,330
We can shoot the lizard.
49
00:02:36,510 --> 00:02:38,040
All of these things are working.
50
00:02:38,040 --> 00:02:42,990
But actually it takes a lot of damage because the health is really high right now.
51
00:02:42,990 --> 00:02:48,570
So on the lizard here, we can go to the top and we can just look for the health.
52
00:02:48,570 --> 00:02:54,420
No, actually it's here on the BPP vitality and just set the health to three also.
53
00:02:55,230 --> 00:02:56,850
And this carrot isn't going to move.
54
00:02:56,850 --> 00:02:59,880
It's either going to be idle or it's going to be shooting a fireball.
55
00:02:59,880 --> 00:03:02,970
So let's create the fireball, the projectile first.
56
00:03:04,220 --> 00:03:05,750
Go through the content drawer.
57
00:03:06,170 --> 00:03:07,520
Under blueprints.
58
00:03:07,520 --> 00:03:09,140
Projectiles.
59
00:03:09,140 --> 00:03:10,220
Enemy.
60
00:03:10,220 --> 00:03:11,930
We don't have anything here yet.
61
00:03:11,930 --> 00:03:12,320
Right.
62
00:03:12,320 --> 00:03:17,570
So as we also established before or the projectiles, we want to have the BP projectile base.
63
00:03:17,570 --> 00:03:18,620
We already created this.
64
00:03:18,620 --> 00:03:23,270
We created the player projectile and we created all the three sub player projectiles.
65
00:03:23,270 --> 00:03:27,320
But now we want to create the BP enemy projectile base.
66
00:03:27,320 --> 00:03:30,440
And this isn't really going to have any properties or anything.
67
00:03:30,440 --> 00:03:32,240
This is just here for good practice.
68
00:03:32,240 --> 00:03:36,440
So if we want to create something else later, we can just easily do this and have these all under the
69
00:03:36,440 --> 00:03:37,430
same umbrella.
70
00:03:37,430 --> 00:03:42,440
And then we just want to create a the enemy projectile lizard and change the flipbook, maybe change
71
00:03:42,440 --> 00:03:43,250
the damage.
72
00:03:43,820 --> 00:03:50,030
So back here go to the projectiles folder, right click the BP projectile base and create a Child Blueprint
73
00:03:50,030 --> 00:03:50,540
class.
74
00:03:50,540 --> 00:03:55,790
And then just call BP Enemy Projectile Base.
75
00:03:56,350 --> 00:03:59,950
And drag this into the enemy folder like this.
76
00:03:59,950 --> 00:04:03,910
And from this again create a child create child blueprint class.
77
00:04:03,910 --> 00:04:09,640
And this is going to be BP enemy projectile lizard.
78
00:04:10,920 --> 00:04:12,840
And this one we want to double click.
79
00:04:15,620 --> 00:04:17,060
In here for the flipbook.
80
00:04:17,060 --> 00:04:21,980
We just want to go to the flipbook and here we can look for fireball.
81
00:04:22,400 --> 00:04:24,740
Yeah, we have the fireball loop.
82
00:04:24,800 --> 00:04:25,460
And yeah.
83
00:04:25,460 --> 00:04:27,230
So it has the same animation.
84
00:04:27,230 --> 00:04:28,580
It's just a different color.
85
00:04:28,580 --> 00:04:32,330
And one thing we talked about before is we want to make the player feel good.
86
00:04:32,330 --> 00:04:32,870
Right.
87
00:04:32,870 --> 00:04:37,160
So the collision on the player projectile should be bigger than it looks.
88
00:04:37,160 --> 00:04:42,500
But for enemies we usually want to make it a little bit smaller than it looks to not have this feeling
89
00:04:42,500 --> 00:04:43,970
of, hey, that shouldn't have hit me.
90
00:04:43,970 --> 00:04:48,710
So we can just go to the sphere and make the sphere radius smaller.
91
00:04:48,710 --> 00:04:51,320
So I think for this one actually, we can go like this.
92
00:04:51,320 --> 00:04:53,840
So it is a little bit smaller than it looks like.
93
00:04:53,840 --> 00:04:57,590
And this is going to make a huge difference in how fair your game feels.
94
00:04:57,590 --> 00:04:59,450
We also want to check the damage.
95
00:04:59,450 --> 00:05:04,370
So when we click here here you can see projectile damage one which I think is a good value considering
96
00:05:04,370 --> 00:05:05,930
our player has ten health.
97
00:05:06,290 --> 00:05:11,870
Now in the enemy lizard, we have to create a function that actually spawns this projectile.
98
00:05:12,200 --> 00:05:16,130
Just click on functions, add a new function and just call it.
99
00:05:17,080 --> 00:05:17,560
Dude.
100
00:05:17,560 --> 00:05:18,700
Fireball.
101
00:05:21,170 --> 00:05:24,830
And now we just want to spawn actor.
102
00:05:25,510 --> 00:05:26,620
From class.
103
00:05:27,600 --> 00:05:33,900
And here select our lizard fireball, the BP enemy projectile lizard.
104
00:05:33,900 --> 00:05:35,520
And here the spawn transform.
105
00:05:35,520 --> 00:05:37,830
We just want to split the struct pin again.
106
00:05:37,830 --> 00:05:40,380
We don't want to have anything for the scale.
107
00:05:40,380 --> 00:05:41,820
The default collision overwrite.
108
00:05:41,820 --> 00:05:45,210
Just always spawn ignore collision to make sure it always spawns.
109
00:05:45,210 --> 00:05:51,660
And for now we can just get actor location to spawn it in the middle of the enemy.
110
00:05:51,660 --> 00:05:55,440
And for the transform the same get actor rotation.
111
00:05:55,440 --> 00:05:58,710
And we're going to change this later to make it come actually from the mouth.
112
00:06:02,030 --> 00:06:06,770
Now let's create an AI controller for the lizard that tells it to shoot at certain intervals.
113
00:06:07,500 --> 00:06:09,000
Back here in the content drawer.
114
00:06:09,030 --> 00:06:17,760
Go to blueprints AI and on the AIC base right click Create Child Blueprint class and called AIC lizard.
115
00:06:18,360 --> 00:06:21,510
And in here we want to do the same thing again we did for the grab.
116
00:06:21,510 --> 00:06:24,720
So on the event graph we don't use the Beginplay.
117
00:06:24,720 --> 00:06:25,560
Get rid of this.
118
00:06:25,560 --> 00:06:27,690
Instead we use the on possess.
119
00:06:28,670 --> 00:06:30,020
Event on possess.
120
00:06:30,410 --> 00:06:33,830
And here we again want to cast the possessed pawn cast to.
121
00:06:33,860 --> 00:06:36,440
In this case, BP lizard.
122
00:06:36,440 --> 00:06:38,930
Actually BP enemy lizard.
123
00:06:39,530 --> 00:06:43,280
And we want to save a reference, promote the variable.
124
00:06:43,280 --> 00:06:45,560
And it's called owning lizard.
125
00:06:46,180 --> 00:06:47,020
Like this.
126
00:06:47,020 --> 00:06:50,440
And again, now we can just use this variable anywhere in our code.
127
00:06:50,440 --> 00:06:53,380
In this case, actually we don't have to use the tick event.
128
00:06:53,380 --> 00:06:58,360
There is a better way for doing this if we just do something at set intervals.
129
00:06:59,480 --> 00:07:03,080
We just want to delete the tick event and create a custom event.
130
00:07:03,750 --> 00:07:06,510
And I'm just going to call it shoot projectile.
131
00:07:07,250 --> 00:07:07,970
Like this.
132
00:07:07,970 --> 00:07:08,900
And what do we do here?
133
00:07:08,900 --> 00:07:11,300
Well, we just call on the owning lizard.
134
00:07:11,300 --> 00:07:13,490
We just shoot fireball.
135
00:07:14,430 --> 00:07:15,390
Like this.
136
00:07:15,900 --> 00:07:19,650
And we just need this event so we can call it from a timer.
137
00:07:19,680 --> 00:07:22,710
It's just a very simple thing, but we need this to call it from a timer.
138
00:07:23,430 --> 00:07:24,960
And how do we call a timer?
139
00:07:24,960 --> 00:07:31,110
So after we possess we just say set timer by event, which we've used before.
140
00:07:31,290 --> 00:07:36,270
And for the event, just look for event and create event.
141
00:07:36,270 --> 00:07:39,450
And here we can then just pick this shoot projectile right.
142
00:07:39,450 --> 00:07:41,610
So we can just look for shoot projectile.
143
00:07:41,610 --> 00:07:45,090
And this is just gonna call this event for us.
144
00:07:45,090 --> 00:07:46,200
We do want it to loop.
145
00:07:46,200 --> 00:07:48,000
So it shoots over and over again.
146
00:07:48,000 --> 00:07:50,250
And here we can give it the interval timing.
147
00:07:50,250 --> 00:07:52,860
Like should it shoot every one second every two seconds.
148
00:07:52,860 --> 00:07:54,840
And we can just set a value here.
149
00:07:55,850 --> 00:08:00,140
For now, let's just try every three seconds and promote this to a variable.
150
00:08:00,140 --> 00:08:02,420
And it's called shoot interval.
151
00:08:03,300 --> 00:08:04,230
Like this.
152
00:08:04,990 --> 00:08:11,950
And to activate this in the BPM lizard, we just want to select the top level and look for AI.
153
00:08:11,950 --> 00:08:15,010
And we have the AI controller class.
154
00:08:15,010 --> 00:08:18,430
And here we just want to select the AIC lizard now.
155
00:08:18,430 --> 00:08:20,500
And this is fine placed in world or spawned.
156
00:08:20,500 --> 00:08:27,100
So we can just compile and save and check this out so I can start the game, can defeat some enemies
157
00:08:27,100 --> 00:08:31,870
and go towards the lizard and you can see that it shoots fireballs every three seconds.
158
00:08:31,870 --> 00:08:36,669
And the functionality is now built in, but it doesn't look like the lizard is actually spitting the
159
00:08:36,669 --> 00:08:37,299
fireball.
160
00:08:37,299 --> 00:08:40,179
We still have to change the animation for that to happen.
161
00:08:40,570 --> 00:08:44,950
And also if we get hit by the projectile, you see that we kind of fly off in the wrong direction.
162
00:08:44,950 --> 00:08:49,630
And also if we exit out, we get an error message because the damage causer is not set.
163
00:08:49,630 --> 00:08:52,270
But that is actually something we'll take care of in the next lesson.
164
00:08:52,270 --> 00:08:53,710
So for now, just ignore it.
165
00:08:55,350 --> 00:08:57,570
Let's look at the animations for the lizard.
166
00:08:57,570 --> 00:09:03,210
We can go to content paper, assets, characters, enemies and lizard.
167
00:09:03,210 --> 00:09:05,850
We have a jump animation, but we're not going to use this.
168
00:09:05,850 --> 00:09:07,800
And we have the shoot animation here.
169
00:09:07,800 --> 00:09:14,400
And this is a really nice animation because it is telescoped, it lets the player know this enemy is
170
00:09:14,400 --> 00:09:15,750
preparing an attack.
171
00:09:15,750 --> 00:09:20,970
And then here on frame three or frame four, actually we're just going to shoot the projectile.
172
00:09:21,600 --> 00:09:26,280
But to do this, we actually need to learn something new because we don't want to shoot the projectile
173
00:09:26,280 --> 00:09:28,080
right when we start the animation, right?
174
00:09:28,110 --> 00:09:33,120
We actually have to wait for the animation and then let the animation decide when we want to shoot the
175
00:09:33,120 --> 00:09:33,900
projectile.
176
00:09:33,900 --> 00:09:35,970
And now again, we have to decide for this character.
177
00:09:35,970 --> 00:09:41,010
Do we use the base paper 2D method without the plugin, or do we make use of the plugin even though
178
00:09:41,010 --> 00:09:42,420
it takes some time to set up?
179
00:09:42,420 --> 00:09:48,960
And I believe in this case I do want to use paper XD because a great feature of it are animation notifies
180
00:09:48,960 --> 00:09:54,810
and activating an event on a certain frame without paper XDD you can still do it, but it is actually
181
00:09:54,810 --> 00:09:56,010
quite annoying.
182
00:09:56,130 --> 00:10:00,570
And on tick you always have to check which animation are we playing currently, which frame are we on,
183
00:10:00,570 --> 00:10:03,300
and then use a do once node to execute an action.
184
00:10:03,300 --> 00:10:06,330
It isn't very intuitive and it's not a great method.
185
00:10:06,330 --> 00:10:08,550
So I think for this we just use paper XDD.
186
00:10:08,670 --> 00:10:12,930
And this also gives me the chance to show you anim notifies and how awesome they are.
187
00:10:12,960 --> 00:10:13,950
So let's do that.
188
00:10:13,950 --> 00:10:21,240
Now in the content drawer we want to go to content blueprints, characters, enemies and we want to
189
00:10:21,240 --> 00:10:23,370
create a folder for the lizard.
190
00:10:24,290 --> 00:10:27,680
And just drag in the BPM lizard like this.
191
00:10:28,220 --> 00:10:30,920
And now right click here paper XDD.
192
00:10:30,920 --> 00:10:33,170
We're going to do the same thing we did for the character.
193
00:10:33,170 --> 00:10:39,140
So first create an animation source and it's called as Enemy Lizard.
194
00:10:39,990 --> 00:10:41,370
Now open this up.
195
00:10:41,370 --> 00:10:43,710
And here we have to register the animations.
196
00:10:43,710 --> 00:10:48,990
So just add new and we want to rename this F2 idle.
197
00:10:49,970 --> 00:10:50,960
And double click.
198
00:10:50,960 --> 00:10:53,690
And on the right side just look for Lizard Idol.
199
00:10:55,290 --> 00:10:57,450
And zoom out here with the scroll wheel.
200
00:10:57,450 --> 00:11:01,500
And then we also want to add the shoot animation.
201
00:11:02,340 --> 00:11:07,050
And here again, double click and look for lizard and shoot.
202
00:11:07,050 --> 00:11:08,430
We don't want to use the jump.
203
00:11:08,430 --> 00:11:11,370
We're not going to register this even just use the shoot animation.
204
00:11:11,370 --> 00:11:12,000
And yeah.
205
00:11:12,000 --> 00:11:13,410
So now we can see this here.
206
00:11:13,920 --> 00:11:15,810
And at the bottom here you can see a timeline.
207
00:11:15,810 --> 00:11:17,490
And this is going to come into play later.
208
00:11:17,490 --> 00:11:20,490
But now we just set up the animation blueprint as well.
209
00:11:20,490 --> 00:11:27,210
So back here in the content drawer in our lizard folder we just right click again paper 3D not paper
210
00:11:27,210 --> 00:11:27,660
2D.
211
00:11:27,780 --> 00:11:30,150
And look for the paper Z and MVP.
212
00:11:30,450 --> 00:11:34,470
And here we have to select our as enemy lizard to base it off of.
213
00:11:34,470 --> 00:11:38,340
And then a BP enemy lizard.
214
00:11:39,330 --> 00:11:41,070
Like this and open it up.
215
00:11:41,860 --> 00:11:43,120
And again on init.
216
00:11:43,120 --> 00:11:47,590
When this is initialized we just want to get owning actor.
217
00:11:49,190 --> 00:11:53,540
And then just cast this to be enemy lizard.
218
00:11:56,430 --> 00:11:58,200
And save a reference.
219
00:11:58,200 --> 00:12:01,290
Promote the variable owning lizard.
220
00:12:01,940 --> 00:12:05,360
And then again, we can just use this in our anim graph like we did for the player.
221
00:12:05,360 --> 00:12:07,340
You've already seen how useful this is.
222
00:12:08,010 --> 00:12:09,540
Open up the anim graph.
223
00:12:09,540 --> 00:12:13,410
And here again just right click create a state machine.
224
00:12:13,830 --> 00:12:15,630
Add new state machine.
225
00:12:15,630 --> 00:12:19,980
And I'm going to call it locomotion like I always do for the basic one.
226
00:12:19,980 --> 00:12:27,510
And just connect this here and now in here we just want to set up the Idle so animation state idle F2
227
00:12:27,540 --> 00:12:28,650
to rename it.
228
00:12:28,890 --> 00:12:30,900
And this is something we've already done before.
229
00:12:30,900 --> 00:12:32,370
So I can go quite fast.
230
00:12:32,370 --> 00:12:38,280
And in here we just want to play idle which again we have access to because we registered it in the
231
00:12:38,280 --> 00:12:39,120
animation source.
232
00:12:39,120 --> 00:12:39,750
Right.
233
00:12:40,370 --> 00:12:43,280
And this is pretty much all we do here.
234
00:12:43,310 --> 00:12:45,260
We only need this one state.
235
00:12:45,470 --> 00:12:46,850
And now for the shooting.
236
00:12:46,850 --> 00:12:48,140
There's multiple options.
237
00:12:48,140 --> 00:12:49,790
We have to implement it.
238
00:12:49,790 --> 00:12:54,530
We could just make another animation state, call it shoot and then transition into it.
239
00:12:54,530 --> 00:12:55,610
Transition out of it.
240
00:12:55,610 --> 00:12:56,780
And this works just fine.
241
00:12:56,780 --> 00:12:58,520
But it's a lot of work for this.
242
00:12:58,520 --> 00:13:01,310
We could again just use a jump right.
243
00:13:01,310 --> 00:13:04,940
And then jump into this and then go back to idle after we're done playing.
244
00:13:04,940 --> 00:13:10,640
This also works fine, but for a one off animation like this, there's actually an even better method.
245
00:13:10,640 --> 00:13:15,500
So we can just delete these two and we go one step back to the anim graph.
246
00:13:15,500 --> 00:13:22,010
And between the state machine and the output animation we have to add a slot so we can just drag off
247
00:13:22,010 --> 00:13:26,630
here look for slot and have a new override slot.
248
00:13:26,780 --> 00:13:28,370
And we can just connect this here.
249
00:13:28,370 --> 00:13:33,710
And this is just necessary for us to use the animation override feature.
250
00:13:33,710 --> 00:13:38,660
And if you've worked with skeletal meshes before, this is pretty similar to animation montages.
251
00:13:38,660 --> 00:13:40,790
And the slots we have for them as well.
252
00:13:41,590 --> 00:13:46,360
So we can pretty much just ignore everything that is happening here and just overwrite it here with
253
00:13:46,360 --> 00:13:48,580
our attack animation or something else.
254
00:13:49,350 --> 00:13:51,930
So now back in the enemy lizard.
255
00:13:51,960 --> 00:13:56,070
Instead of shooting the fireball, we can just hit alt and click this line.
256
00:13:56,070 --> 00:13:58,710
We just want to play the animation for now.
257
00:13:59,480 --> 00:14:03,290
And this is actually quite easy because we set up this slot here.
258
00:14:03,320 --> 00:14:09,590
Now in the blueprints we can just get the animation component from paper XDD.
259
00:14:10,160 --> 00:14:12,410
Here get anim instance.
260
00:14:13,550 --> 00:14:16,760
And here we can just look for overwrite.
261
00:14:16,760 --> 00:14:20,150
And here we have three functions related to overrides.
262
00:14:20,150 --> 00:14:24,230
And the one we want is play animation override like this.
263
00:14:25,810 --> 00:14:27,340
And just connect it here.
264
00:14:29,650 --> 00:14:30,190
And yes.
265
00:14:30,190 --> 00:14:31,600
So this gives us the target.
266
00:14:31,600 --> 00:14:33,130
The target is the anim instance.
267
00:14:33,130 --> 00:14:37,210
The anim sequence is the thing we want to play, the animation we want to play.
268
00:14:37,210 --> 00:14:38,680
But here we have to be careful.
269
00:14:38,680 --> 00:14:43,780
There's actually all the animations for all the characters, and we need to make sure we pick one that
270
00:14:43,780 --> 00:14:45,520
works with our character.
271
00:14:45,520 --> 00:14:50,200
So especially in the case of let's say it's idle, it is really hard because you have three different
272
00:14:50,200 --> 00:14:51,790
animations that are called idle.
273
00:14:51,790 --> 00:14:54,130
So if you hover, you actually have to look at the path.
274
00:14:54,130 --> 00:14:59,920
You see game blueprints, characters, enemies, lizard anim sequence, and here you see blueprints,
275
00:14:59,920 --> 00:15:02,110
characters, player anim sequences.
276
00:15:02,110 --> 00:15:06,520
So this path can actually help you figure out if this is correct for your character.
277
00:15:06,520 --> 00:15:08,470
But now we just want to use the chute.
278
00:15:08,650 --> 00:15:13,480
And here again we need to be careful because there's multiple shoot animations.
279
00:15:13,480 --> 00:15:17,500
And here again I look at the path I see game blueprints, characters, enemies, lizard.
280
00:15:17,500 --> 00:15:22,840
So I know this is the correct one and just pick it and player it is just how fast we play it.
281
00:15:22,840 --> 00:15:29,020
Yes, 1.0 is fine and the starting position if we play from the start or play from the middle, but
282
00:15:29,020 --> 00:15:33,280
there's actually one more important thing we have to do, and we still have to click on the animation
283
00:15:33,280 --> 00:15:38,350
component and make sure and make sure that here under paper XDD.
284
00:15:38,650 --> 00:15:45,610
For the anim instance class, we are selecting the BP abp enemy lizard because otherwise it doesn't
285
00:15:45,610 --> 00:15:47,620
know which animation blueprint to use.
286
00:15:47,620 --> 00:15:52,330
And yeah, so we just select the blueprint and then we can call this play Anim Override.
287
00:15:52,420 --> 00:15:54,400
And we can check this out now.
288
00:15:56,880 --> 00:16:00,810
And now every three seconds you can see that we are playing this shoot animation.
289
00:16:01,490 --> 00:16:05,870
So this is working, but we also still have to actually shoot the projectile.
290
00:16:05,870 --> 00:16:10,760
One more cool thing I want to show you is that if we just copy paste these two and we go out in the
291
00:16:10,760 --> 00:16:17,150
event graph and just put it anywhere, and we drag off here and type in overwrite, we actually have
292
00:16:17,150 --> 00:16:21,350
a fourth option which is play animation overwrite with callbacks.
293
00:16:21,350 --> 00:16:26,360
We don't need this in this case, but this is actually super useful, just like we had for the slide.
294
00:16:26,360 --> 00:16:29,360
This also gives us an uncompleted and on cancelled event.
295
00:16:29,360 --> 00:16:35,810
So for example, if you use this for a sword attack and maybe you want to lock the player in place,
296
00:16:35,810 --> 00:16:39,020
then you could have like an is attacking boolean here.
297
00:16:39,020 --> 00:16:42,470
And then after it's completed just set is attacking back to false.
298
00:16:42,470 --> 00:16:44,210
And then you can walk again.
299
00:16:44,210 --> 00:16:46,160
Or you can handle cooldowns in this way.
300
00:16:46,160 --> 00:16:48,590
And you can see this clock on the top right.
301
00:16:48,590 --> 00:16:51,110
So this is actually using a delay internally.
302
00:16:51,110 --> 00:16:53,990
And this is why we cannot use this inside of a function.
303
00:16:53,990 --> 00:16:55,850
We can only use this on the event graph.
304
00:16:55,850 --> 00:17:00,590
So if you want to use this you have to make a custom event, connect it and do all of those things which
305
00:17:00,590 --> 00:17:02,270
we've done a couple of times before.
306
00:17:02,270 --> 00:17:03,980
And I just wanted to show you this.
307
00:17:04,829 --> 00:17:07,589
And now let's spawn the projectile on the correct frame.
308
00:17:07,589 --> 00:17:11,819
And here we want to use the as enemy lizard, the animation source.
309
00:17:12,089 --> 00:17:15,599
And if you don't have it open, just go back to the folder here for the lizard.
310
00:17:15,780 --> 00:17:20,970
And here we just want to click on pause now and see where exactly do we want to spawn the projectile.
311
00:17:20,970 --> 00:17:22,260
And I think exactly.
312
00:17:22,260 --> 00:17:24,480
Frame four is where we want to spawn it.
313
00:17:25,099 --> 00:17:31,790
So while you are on the same height as the track one, we can right click and add notify and just make
314
00:17:31,790 --> 00:17:33,380
a new notify.
315
00:17:33,380 --> 00:17:35,480
And I'm just going to call it spit.
316
00:17:36,440 --> 00:17:38,810
And now it is kind of in the middle of four.
317
00:17:38,810 --> 00:17:44,030
It's not going to make a difference, but we can just right click it, click on four here and hit enter
318
00:17:44,030 --> 00:17:46,160
to make sure it aligns perfectly.
319
00:17:46,160 --> 00:17:47,660
And this just looks nicer.
320
00:17:47,660 --> 00:17:49,850
Makes it a more clear what we want to do here.
321
00:17:49,850 --> 00:17:52,280
And what does this notify do.
322
00:17:52,280 --> 00:17:58,100
Well, if we go back to the ABP enemy lizard now because these are connected it creates this receive
323
00:17:58,100 --> 00:17:59,330
notify spit.
324
00:17:59,330 --> 00:18:01,940
And this then lets us do whatever we want to do.
325
00:18:01,940 --> 00:18:04,310
And here we can just call the owning lizard.
326
00:18:04,310 --> 00:18:06,260
And we can then just call a function here.
327
00:18:06,260 --> 00:18:07,100
But now.
328
00:18:07,100 --> 00:18:09,980
But now we get rid of the function that spawns the projectile.
329
00:18:09,980 --> 00:18:15,230
So back in the BP enemy lizard we want to go back to the shoot fireball.
330
00:18:15,230 --> 00:18:18,020
And here we have this where we actually spawn the projectile.
331
00:18:18,020 --> 00:18:26,450
So we can just hit control X and then create a new function and just call it spawn projectile.
332
00:18:27,830 --> 00:18:29,300
And just put it here.
333
00:18:30,020 --> 00:18:31,340
And do this.
334
00:18:31,730 --> 00:18:33,200
And now compile and save.
335
00:18:33,290 --> 00:18:34,400
Important.
336
00:18:34,400 --> 00:18:39,590
And now back in the APB enemy here for the receive notify spit.
337
00:18:39,590 --> 00:18:43,610
Well, now we can just spawn projectile like this.
338
00:18:44,250 --> 00:18:45,510
And let's check it out.
339
00:18:45,510 --> 00:18:46,680
Compile and save.
340
00:18:47,130 --> 00:18:47,970
Go here.
341
00:18:51,080 --> 00:18:51,410
Right.
342
00:18:51,410 --> 00:18:54,440
We can see the projector now spawns on the correct frame.
343
00:18:55,200 --> 00:18:57,900
And this is something you can use in a lot of different ways.
344
00:18:57,900 --> 00:19:02,160
Whenever you want to trigger something at a certain point in an animation.
345
00:19:02,490 --> 00:19:06,360
Now, the last thing we want to do in this video is to change the spawn position slightly, to have
346
00:19:06,360 --> 00:19:08,580
it actually come out of the mouth of the lizard.
347
00:19:08,790 --> 00:19:14,100
And again, we've done this for the player before where we set a location to shoot, and on the BPM
348
00:19:14,100 --> 00:19:19,710
lizard, we can just go to the viewport and select the capsule component and add a scene.
349
00:19:20,580 --> 00:19:22,110
Like this and it's called it.
350
00:19:22,110 --> 00:19:22,650
Shoot.
351
00:19:22,650 --> 00:19:23,460
Pause.
352
00:19:25,900 --> 00:19:26,740
And on the sprite.
353
00:19:26,740 --> 00:19:30,310
We just want to play the lizard shoot animation.
354
00:19:30,310 --> 00:19:33,760
And here I just want to set it to 0.1.
355
00:19:33,760 --> 00:19:35,470
So it plays very slowly.
356
00:19:35,470 --> 00:19:39,730
And now I can get the shoot pass and adjust it accordingly.
357
00:19:40,180 --> 00:19:41,200
Let's see.
358
00:19:41,710 --> 00:19:45,460
And yeah this looks about right a little bit more here and here.
359
00:19:47,270 --> 00:19:49,940
And yeah, so this lines up perfectly now.
360
00:19:49,940 --> 00:19:55,580
And now I can just go back to the sprite, set it back to player rate of one, and just set it back
361
00:19:55,580 --> 00:19:57,710
to the lizard idle animation.
362
00:19:57,710 --> 00:20:03,800
And now where we spawn the projectile instead of get actor location get actor forward rotation.
363
00:20:03,800 --> 00:20:09,470
Just get rid of this, get the shoot pass and here get world location.
364
00:20:09,470 --> 00:20:10,850
Because it is a component.
365
00:20:10,850 --> 00:20:17,480
It doesn't have an actor location, it just has a world location and also get world rotation.
366
00:20:18,330 --> 00:20:19,140
Like this.
367
00:20:20,370 --> 00:20:25,110
And connect it here and now compile and save and let's go here.
368
00:20:26,680 --> 00:20:27,550
And let's see.
369
00:20:27,850 --> 00:20:28,180
And.
370
00:20:28,180 --> 00:20:28,690
Yeah.
371
00:20:29,570 --> 00:20:31,970
It is now spawning at the correct position.
372
00:20:32,000 --> 00:20:37,400
It flies over our head slightly and this is what I said before with making the collisions a little bit
373
00:20:37,400 --> 00:20:40,130
smaller, but this is actually missing us by a hair.
374
00:20:40,130 --> 00:20:43,460
So maybe for you, if you have the collision even a little bit differently, it's actually going to
375
00:20:43,460 --> 00:20:44,270
hit your head.
376
00:20:44,270 --> 00:20:45,950
So you might want to make some adjustments.
377
00:20:45,950 --> 00:20:48,500
But actually maybe you want to do it that way.
378
00:20:48,500 --> 00:20:49,100
And yeah.
379
00:20:49,100 --> 00:20:52,610
So now we can shoot it and everything is working fine with the lizard.
380
00:20:52,610 --> 00:20:53,210
But yeah.
381
00:20:53,240 --> 00:20:57,110
Now in the next video I want to take care of the projectile knockback because we still have the issue
382
00:20:57,110 --> 00:21:00,020
that we flying the wrong direction and we get this error message.
34340
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.