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:02,330
Now that our projectile is working, it disappears.
2
00:00:02,330 --> 00:00:05,660
If we hit the wall, we want to show the explosion flipbook.
3
00:00:05,660 --> 00:00:10,520
So in the paper assets FX, we have the player shot hit.
4
00:00:10,520 --> 00:00:11,000
Right.
5
00:00:11,000 --> 00:00:12,650
So this one we want to play this.
6
00:00:12,680 --> 00:00:13,790
If we hit the wall.
7
00:00:13,790 --> 00:00:17,870
And the way we're going to implement this is we're going to create a separate blueprint that just plays
8
00:00:17,870 --> 00:00:18,410
a flipbook.
9
00:00:18,410 --> 00:00:21,740
And if the flipbook is done playing, the blueprint is just going to despawn.
10
00:00:21,740 --> 00:00:24,230
And this is a very common way of handling these.
11
00:00:24,710 --> 00:00:27,890
So go back to the content drawer.
12
00:00:28,380 --> 00:00:33,780
And in blueprints, we're gonna create a new one new folder called VFX.
13
00:00:35,000 --> 00:00:35,990
And open it up.
14
00:00:35,990 --> 00:00:38,450
And here create a new blueprint class.
15
00:00:38,450 --> 00:00:39,740
It's going to be very simple.
16
00:00:39,740 --> 00:00:44,750
So just an actor and call it BP VFX base.
17
00:00:45,520 --> 00:00:46,630
In caps.
18
00:00:46,630 --> 00:00:48,790
And again here we're going to use inheritance.
19
00:00:48,790 --> 00:00:50,380
But this is extremely simple.
20
00:00:50,380 --> 00:00:52,000
So I didn't create a graph.
21
00:00:52,000 --> 00:00:54,340
We're just going to have the base with all the setups.
22
00:00:54,340 --> 00:00:58,360
And then just have a different child for each effect where we only change the flipbook.
23
00:00:58,360 --> 00:01:02,770
But let's start with this one first the Pvpve base as the baseline.
24
00:01:02,770 --> 00:01:06,070
So here we just add a flipbook.
25
00:01:07,420 --> 00:01:08,440
Paper flip book.
26
00:01:08,440 --> 00:01:14,680
And here for the sauce flip book, we want to use the we want to use the hit loop.
27
00:01:14,680 --> 00:01:16,660
The player shot hit loop.
28
00:01:16,660 --> 00:01:18,370
And now it just keeps on looping.
29
00:01:18,370 --> 00:01:24,370
But what we want is to just play it a single time and then have the entire blueprint be destroyed again.
30
00:01:24,370 --> 00:01:30,370
First, we want to set the paper flip book to No Collision because this should just be in effect, no
31
00:01:30,370 --> 00:01:30,730
collision.
32
00:01:30,730 --> 00:01:32,650
We don't want anything to collide with this.
33
00:01:33,610 --> 00:01:37,630
Again to demonstrate how this works, we're just going to drag it into the level.
34
00:01:37,630 --> 00:01:43,390
Just drag an instance in here and you can see that it just keeps on playing like this.
35
00:01:43,390 --> 00:01:47,050
But what we want is to just play the one time and then destroy it.
36
00:01:47,540 --> 00:01:52,730
So even though we have Paper XRD setup and we could have these animation trees and all of that, this
37
00:01:52,730 --> 00:01:58,370
is something so simple, it is actually easier to just do all of this in the blueprint using the base
38
00:01:58,370 --> 00:01:59,930
paper 2D toolset.
39
00:01:59,930 --> 00:02:03,620
If we click on the flipbook, we can scroll down to the events.
40
00:02:03,620 --> 00:02:07,040
And here you see the on finished playing event.
41
00:02:07,040 --> 00:02:10,460
And this is something that comes from paper 2D on Flipbooks.
42
00:02:10,460 --> 00:02:12,170
And we can just add the event.
43
00:02:12,170 --> 00:02:15,530
And it's just going to tell us when the flipbook is done playing.
44
00:02:15,530 --> 00:02:17,300
So we can just print string here.
45
00:02:17,840 --> 00:02:20,540
For now and just say done.
46
00:02:21,260 --> 00:02:25,460
And if we start now, you're going to see that this is actually not enough, right?
47
00:02:25,460 --> 00:02:26,330
It's not showing up.
48
00:02:26,330 --> 00:02:32,900
It keeps on playing because we need to make sure that this flipbook is set to not looping, because
49
00:02:32,900 --> 00:02:35,720
this event will never trigger on a looping flipbook.
50
00:02:35,720 --> 00:02:41,780
And we can get rid of the actor, begin overlap and the tick and just want to go to begin play.
51
00:02:41,780 --> 00:02:45,470
And here we drag from the paper flipbook and set looping.
52
00:02:45,980 --> 00:02:47,390
And set this to false.
53
00:02:47,390 --> 00:02:48,860
New looping to false.
54
00:02:48,860 --> 00:02:52,940
So when we spawn this in we're just going to set it to not looping.
55
00:02:52,940 --> 00:02:58,130
And then this event is going to trigger if the animation is done playing one time.
56
00:02:58,460 --> 00:03:00,320
Compile and save and let's check it out.
57
00:03:00,320 --> 00:03:01,670
And you can see it says done.
58
00:03:01,670 --> 00:03:03,320
And then it simply stops playing.
59
00:03:03,320 --> 00:03:06,320
It's still visible but it stopped playing.
60
00:03:06,710 --> 00:03:12,650
And we can then just go here and instead of saying done well we can simply destroy actor.
61
00:03:13,850 --> 00:03:15,110
Just like this.
62
00:03:15,710 --> 00:03:17,720
And this is all there is to it.
63
00:03:17,720 --> 00:03:18,620
This is super simple.
64
00:03:18,620 --> 00:03:20,600
We just set the flipbook.
65
00:03:20,600 --> 00:03:21,830
We set it to not looping.
66
00:03:21,830 --> 00:03:25,550
Once it's done playing one repetition of the animation, we just destroy the actor.
67
00:03:25,730 --> 00:03:27,050
And let's check this out.
68
00:03:27,080 --> 00:03:29,360
Now I simulate and it plays once.
69
00:03:29,950 --> 00:03:30,820
It's gone.
70
00:03:31,300 --> 00:03:33,610
And this is exactly what we need.
71
00:03:33,610 --> 00:03:38,500
But with things like this, you got to be a little bit careful, because spawning an actor and destroying
72
00:03:38,500 --> 00:03:43,780
an actor actually uses up quite a bit of resources on your computer and memory, because we have to
73
00:03:43,780 --> 00:03:45,760
instantiate things and destroy them.
74
00:03:45,760 --> 00:03:49,060
So in an ideal scenario, you would set up a pooling method.
75
00:03:49,060 --> 00:03:52,120
But this is a very advanced topic we're not going to get into.
76
00:03:52,120 --> 00:03:54,100
And you don't really have to worry about it too much.
77
00:03:54,100 --> 00:03:57,160
But that is just one way you could optimize things like this.
78
00:03:57,790 --> 00:04:00,310
And like we said, this is only the base.
79
00:04:00,310 --> 00:04:02,260
So this is the pvf base.
80
00:04:02,260 --> 00:04:04,570
We don't actually want to use this in our levels.
81
00:04:04,570 --> 00:04:11,740
So let's just create a child blueprint class and just call BP underscore VFX.
82
00:04:13,350 --> 00:04:13,980
Shot.
83
00:04:13,980 --> 00:04:16,110
Hit, shot.
84
00:04:16,810 --> 00:04:17,470
Hit.
85
00:04:19,040 --> 00:04:23,630
And in here, we're not going to change anything because this is just going to use the default values
86
00:04:23,630 --> 00:04:24,500
we set here.
87
00:04:24,500 --> 00:04:29,570
But it is a blueprint we actually want to use in the level instead of the default, because the default
88
00:04:29,570 --> 00:04:30,860
could possibly change.
89
00:04:31,370 --> 00:04:37,910
Now, instead of just dragging this into the level, we want to actually spawn this from the BP projectile
90
00:04:37,940 --> 00:04:41,630
base, and we want to spawn this when we hit the wall.
91
00:04:41,960 --> 00:04:48,860
And there are multiple ways we could go about this, we could simply spawn actor from class.
92
00:04:49,940 --> 00:04:51,320
And spawn it here.
93
00:04:52,780 --> 00:04:53,350
Right.
94
00:04:53,350 --> 00:04:55,750
Go here and connect this.
95
00:04:55,810 --> 00:05:02,080
If we hit something and here we now need to select our BP VFX shot hit.
96
00:05:02,080 --> 00:05:03,550
So let's look for shot hit.
97
00:05:04,280 --> 00:05:05,840
PVCs charted.
98
00:05:06,440 --> 00:05:12,170
And we then need to give it a spawn transform so we can just right click split the struct pin.
99
00:05:12,170 --> 00:05:13,970
We don't want to set a transform scale.
100
00:05:13,970 --> 00:05:17,750
Usually you just want to keep this as 111 for the location.
101
00:05:17,750 --> 00:05:22,190
Well, we can just get actor location off the projectile.
102
00:05:22,190 --> 00:05:24,560
So where the projectile is destroyed.
103
00:05:24,560 --> 00:05:30,590
And for the rotation, we can also just get actor rotation of the projectile that spawns this.
104
00:05:30,680 --> 00:05:32,330
And this one is a little bit tricky.
105
00:05:32,330 --> 00:05:36,770
The collision handling override in case something is blocking the position.
106
00:05:36,770 --> 00:05:39,410
Here we just want to select always spawn ignore collision.
107
00:05:39,410 --> 00:05:43,760
So even if there is something that should block us, we're just going to ignore it because well there
108
00:05:43,760 --> 00:05:46,700
is no collision in our shotted and this is just a safety.
109
00:05:46,850 --> 00:05:50,270
And we can then just compile and save and play this.
110
00:05:51,110 --> 00:05:52,940
And you can see we hit the wall.
111
00:05:54,560 --> 00:05:56,450
And we play the flipbook.
112
00:05:56,480 --> 00:05:59,300
The projectile disappears, the flipbook disappears.
113
00:05:59,300 --> 00:06:02,060
And this is a simple way of playing this.
114
00:06:02,060 --> 00:06:05,150
However, I prefer a slightly different way of doing this.
115
00:06:05,150 --> 00:06:12,470
Instead of doing this from the hit event, I want to use the override for the Ondestroy event.
116
00:06:12,470 --> 00:06:16,790
So here in the functions there's override labels, and these come from the actor class.
117
00:06:16,790 --> 00:06:22,730
So here we have the on destroyed or actually destroyed event which we can use.
118
00:06:22,730 --> 00:06:25,700
And this is going to trigger when we call destroy actor.
119
00:06:25,700 --> 00:06:28,580
And it's going to execute it before the actor is deleted.
120
00:06:28,580 --> 00:06:30,110
So we can just select all of this.
121
00:06:30,110 --> 00:06:37,580
We can hold alt and left click to disconnect the lines and drag this down here and connect it here like
122
00:06:37,580 --> 00:06:38,390
this.
123
00:06:38,720 --> 00:06:41,360
And then go here connect this again.
124
00:06:41,360 --> 00:06:43,460
And this is just personal preference right.
125
00:06:43,460 --> 00:06:45,320
We could use this here as well.
126
00:06:45,320 --> 00:06:50,810
But then we also need to make sure that on other events where we want this to explode we also have to
127
00:06:50,810 --> 00:06:51,830
call it manually.
128
00:06:51,830 --> 00:06:55,520
But I think most of the time when we destroy this we actually want to call this.
129
00:06:55,520 --> 00:07:00,530
So this is just this just creates a nice funnel that we're always sure this is going to play.
130
00:07:00,530 --> 00:07:02,330
When we destroy the projectile.
131
00:07:02,330 --> 00:07:06,290
Now we can just compile and save and just see that it works the same way.
132
00:07:06,290 --> 00:07:06,800
Right?
133
00:07:06,800 --> 00:07:12,410
It just disappears and everything still works the same way it did when we had it up here.
134
00:07:12,410 --> 00:07:15,440
But this is just my personal preference to do it here.
135
00:07:16,710 --> 00:07:19,830
And now we can just close all of this down.
136
00:07:20,750 --> 00:07:22,700
And just return to our map.
137
00:07:23,320 --> 00:07:25,390
And make sure to save everything.
138
00:07:25,390 --> 00:07:26,680
File save all.
139
00:07:26,890 --> 00:07:29,890
And this is pretty much it for playing a particle effect.
140
00:07:29,890 --> 00:07:35,680
And we can later on reuse our pvpve base to play other particle effects very easily.
141
00:07:36,480 --> 00:07:40,920
In the next lesson, we're actually going to enable the player to shoot these projectiles instead of
142
00:07:40,920 --> 00:07:42,450
just dragging them into the map.
12760
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.