All language subtitles for 007 Adding functionality to our Blueprint[UdemyIran.Com]

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,110 --> 00:00:03,350 In this section, we'll add actual gameplay logic to our pick up blueprint. 2 00:00:03,969 --> 00:00:07,930 Open up the content drawer and open up the BP pickup. 3 00:00:09,520 --> 00:00:11,260 Go to the event graph. 4 00:00:13,300 --> 00:00:19,180 And here you can see that we already have a beginplay node an actor begin overlap node and a tick node. 5 00:00:19,210 --> 00:00:23,140 The Beginplay event will be triggered one time when the actor is initialized. 6 00:00:23,170 --> 00:00:26,440 This could be when starting the game or when spawning the actor. 7 00:00:27,550 --> 00:00:31,510 To demonstrate this, let's click on the arrow here and drag the node away. 8 00:00:32,080 --> 00:00:34,780 If you let go, this context menu will pop up. 9 00:00:35,230 --> 00:00:37,450 Here we can search for print string. 10 00:00:39,350 --> 00:00:40,610 And press enter. 11 00:00:42,770 --> 00:00:47,390 Now when we start the game, we can see here on the left side that hello is printed twice. 12 00:00:50,680 --> 00:00:53,530 This is because we have two instances of this blueprint. 13 00:00:54,620 --> 00:00:58,460 Select one of these and click the delete key on your keyboard. 14 00:00:59,560 --> 00:01:03,910 When you start the game now, you see that it only pops up a single time for one BP pickup. 15 00:01:07,930 --> 00:01:11,650 You can also just right click in the event graph and it will bring up the same menu. 16 00:01:11,680 --> 00:01:16,150 There are countless functions available here and you don't really have to know all of them. 17 00:01:17,170 --> 00:01:21,490 There's probably 10% of these that you will just use over and over again and get used to them. 18 00:01:22,690 --> 00:01:27,610 Uh, many things you know, from programming are also available here, such as a for loop, for example. 19 00:01:29,490 --> 00:01:31,320 And we can just connect this here. 20 00:01:31,320 --> 00:01:34,590 And as an example, put the last index to five. 21 00:01:34,590 --> 00:01:37,050 So this will spin around five times. 22 00:01:39,130 --> 00:01:44,830 We can select the print string node here and press control and C to copy it, then control and V to 23 00:01:44,830 --> 00:01:45,910 paste it in here. 24 00:01:46,330 --> 00:01:48,400 And then just connect the loop body here. 25 00:01:50,920 --> 00:01:55,930 When we start the game now, you can see that Halo's been printed multiple times, which happened because 26 00:01:55,930 --> 00:01:56,740 of our loop. 27 00:02:02,950 --> 00:02:04,870 But now we can just delete this again. 28 00:02:05,510 --> 00:02:08,990 But I hope you understand how important the Begin Play event is. 29 00:02:09,050 --> 00:02:13,610 This is commonly used for many different things, such as spawning objects in your level on begin play, 30 00:02:13,610 --> 00:02:17,540 or maybe putting ammo into your guns and a lot of different things. 31 00:02:18,930 --> 00:02:22,230 For now, let's skip the begin Overlap event and talk about tick. 32 00:02:23,380 --> 00:02:25,480 Take will be called on every single frame. 33 00:02:25,480 --> 00:02:26,920 This actor is active. 34 00:02:27,220 --> 00:02:31,300 This makes it both useful but also dangerous if you don't know how to use it properly. 35 00:02:31,930 --> 00:02:34,210 To demonstrate this again, drag off here. 36 00:02:35,900 --> 00:02:37,430 And add a print string. 37 00:02:39,760 --> 00:02:43,900 When you start the game now you can see that Halo's been printed over and over and over again. 38 00:02:47,020 --> 00:02:52,060 To get a better understanding of what a frame is, we can click here and show this. 39 00:02:52,690 --> 00:02:55,840 And you can see that our game is running at 60 frames per second. 40 00:02:56,430 --> 00:03:01,020 This means that the halo is being also printed 60 times in a single second. 41 00:03:02,340 --> 00:03:05,940 However, this frame rate is not set in stone, and it can change depending on what's happening on the 42 00:03:05,940 --> 00:03:07,920 screen and it can slow down the game. 43 00:03:08,160 --> 00:03:12,540 And as I said, it can be extremely useful because you can update things on every frame. 44 00:03:12,570 --> 00:03:16,770 However, you need to be very careful not to have heavy operations on tick because that can easily slow 45 00:03:16,770 --> 00:03:17,550 down your game. 46 00:03:17,850 --> 00:03:23,130 This is often used for dynamically setting the speed of your character, tracing for objects and things 47 00:03:23,130 --> 00:03:23,820 like that. 48 00:03:24,670 --> 00:03:27,250 I want to show you how to disconnect a line like this. 49 00:03:27,460 --> 00:03:30,220 You can simply hold the alt key and click it. 50 00:03:31,290 --> 00:03:32,700 This will delete it. 51 00:03:33,750 --> 00:03:39,690 Another method is to connect it first, double click it to create a root node, and you can just select 52 00:03:39,690 --> 00:03:41,820 the root node and also click delete. 53 00:03:42,640 --> 00:03:45,220 And these are two ways you can get rid of these lines. 54 00:03:46,300 --> 00:03:50,410 The actor begin overlap event is something I actually don't like to use at all. 55 00:03:51,150 --> 00:03:55,470 Because it is quite ambiguous and you don't really know which overlap you're talking about. 56 00:03:56,390 --> 00:03:58,910 You can just select it and hit delete. 57 00:03:59,740 --> 00:04:04,150 Instead, it's better to use the overlap event on the component that we want to use. 58 00:04:04,810 --> 00:04:09,160 We can select the sphere and scroll all the way down. 59 00:04:09,400 --> 00:04:11,440 And here we have the available events. 60 00:04:11,980 --> 00:04:17,380 The event we want to use is on component Begin overlap, because we want to make it a pickup that the 61 00:04:17,380 --> 00:04:18,490 player can pick up. 62 00:04:19,029 --> 00:04:20,079 Click on plus. 63 00:04:21,430 --> 00:04:25,660 You can see that there are many outputs coming off of this event, which makes it a bit complicated, 64 00:04:25,660 --> 00:04:27,970 but we actually don't need to use most of them. 65 00:04:30,100 --> 00:04:30,670 At first. 66 00:04:30,670 --> 00:04:32,650 Let's just print the other actor. 67 00:04:32,800 --> 00:04:36,040 So again, drag off and create a print string. 68 00:04:38,710 --> 00:04:42,760 And then we can just drag off from other actor and put it into the in string. 69 00:04:48,510 --> 00:04:51,840 However, since the sphere is still blocking, we don't get an overlap event. 70 00:04:51,870 --> 00:04:54,330 We need to change the collision on it first. 71 00:04:57,210 --> 00:05:00,600 We can select the sphere and scroll to the. 72 00:05:01,960 --> 00:05:03,730 Collision Presets section. 73 00:05:03,910 --> 00:05:07,060 As you can see here, it's set to block all dynamic. 74 00:05:11,710 --> 00:05:17,020 If you open this up, you can see the details and you can see that it blocks trace responses and also 75 00:05:17,020 --> 00:05:20,590 blocks world dynamic pawns, pretty much blocks everything. 76 00:05:21,100 --> 00:05:24,640 What we want to do though, is set this to overlap all dynamic. 77 00:05:26,500 --> 00:05:31,960 Our character is a pawn, so we can see that overlap with pawn is checked, which is exactly what we 78 00:05:31,960 --> 00:05:32,470 need. 79 00:05:34,720 --> 00:05:39,340 These collision presets can get very complicated, and it would be too big of a site engine to go into 80 00:05:39,340 --> 00:05:41,710 detail here, but this is all you need to know for now. 81 00:05:43,570 --> 00:05:49,750 Now when we start the game, the character will actually walk through the sphere and we can see BP third 82 00:05:49,750 --> 00:05:52,060 person character being printed on the left side. 83 00:05:54,160 --> 00:05:57,730 So our pick up correctly understands that the character is walking into it. 84 00:05:59,190 --> 00:06:02,130 The first thing you want to do is make this pickup disappear. 85 00:06:02,490 --> 00:06:04,290 So after the print string. 86 00:06:05,230 --> 00:06:07,840 We can simply call destroy actor. 87 00:06:11,730 --> 00:06:18,510 And if we try it out now, we can see that the sphere disappears and the actor as a whole actually disappears 88 00:06:18,510 --> 00:06:19,200 as well. 89 00:06:23,430 --> 00:06:27,330 This great actor is a function that is available on the actor class by default. 90 00:06:28,470 --> 00:06:32,880 With our current setup though, one thing that can happen is that another actor that is not the player 91 00:06:32,880 --> 00:06:34,530 will also destroy this sphere. 92 00:06:38,150 --> 00:06:40,670 To demonstrate this, we can duplicate the sphere. 93 00:06:41,480 --> 00:06:43,790 You can simply drag one more in here. 94 00:06:44,770 --> 00:06:50,260 But you can also hold alt and drag off here to create another instance of it. 95 00:06:51,060 --> 00:06:52,590 So the way we can test this. 96 00:06:52,590 --> 00:06:59,760 To start the game, click on eject and then select one of these spheres and move it into the other one. 97 00:07:00,150 --> 00:07:02,460 And you can see that both of these disappear. 98 00:07:02,730 --> 00:07:08,130 So we need to add a way to check that only the player can can make these disappear and not other objects. 99 00:07:12,620 --> 00:07:14,480 For now, let's delete the print string. 100 00:07:15,510 --> 00:07:21,360 The easiest way we can do this is to drag off of other actor and cast to BP. 101 00:07:21,360 --> 00:07:23,730 Underscore third person character. 102 00:07:27,230 --> 00:07:30,530 And connect the execution pin here to destroy actor. 103 00:07:31,510 --> 00:07:33,490 To display that the cast failed. 104 00:07:33,490 --> 00:07:35,290 We can have a print string here. 105 00:07:37,730 --> 00:07:40,820 And just say not player. 106 00:07:41,470 --> 00:07:44,290 So if it is a player, the actor will be destroyed. 107 00:07:44,290 --> 00:07:46,930 If it's not a player, it will just print, not player. 108 00:07:47,840 --> 00:07:49,340 Let's test this out. 109 00:07:49,820 --> 00:07:52,310 So here we can walk in and it's destroyed. 110 00:07:52,310 --> 00:07:53,900 Nothing is being displayed. 111 00:07:53,990 --> 00:07:57,200 Now we can press shift and F1 to get our mouse back. 112 00:07:57,200 --> 00:08:02,180 Click on eject and drag the sphere in here and you can see it's showing not player. 113 00:08:04,670 --> 00:08:09,530 So now we have a proper way to check for the player, and only then make the sphere disappear. 114 00:08:13,490 --> 00:08:19,040 So this cast checks if the other actor is compatible with the third person character, and then changes 115 00:08:19,040 --> 00:08:20,630 the execution depending on it. 116 00:08:20,660 --> 00:08:21,980 One more thing it does. 117 00:08:21,980 --> 00:08:26,210 It actually gives us access to all of the functions available on the third person character. 118 00:08:27,030 --> 00:08:33,570 For example, we can look for jump here and force the character to jump after picking up the pickup. 119 00:08:36,539 --> 00:08:36,960 Here. 120 00:08:36,960 --> 00:08:38,039 I'm not pressing space. 121 00:08:38,039 --> 00:08:40,350 This is actually just happening through the blueprint. 122 00:08:47,520 --> 00:08:50,520 So I hope this makes you understand how useful casting is. 123 00:08:51,370 --> 00:08:57,130 However, casting also has its downside because it's actually quite computationally heavy and can slow 124 00:08:57,130 --> 00:08:59,080 down your game if you use it too much. 125 00:09:00,040 --> 00:09:05,350 For something like an overlap, it's just fine because it's not happening on every frame or that frequently. 126 00:09:05,350 --> 00:09:07,930 However, you definitely don't want to use this on tick. 127 00:09:08,720 --> 00:09:13,100 Once you get more experienced, instead of using casts, you can actually use interfaces which are very 128 00:09:13,100 --> 00:09:13,910 lightweight. 129 00:09:14,390 --> 00:09:18,050 However, that is a very advanced topic and we're not going to cover it at this point. 130 00:09:18,590 --> 00:09:23,090 So for now, feel free to just use casting everywhere, but make sure to not forget that it actually 131 00:09:23,090 --> 00:09:24,200 has a cost to it. 132 00:09:24,710 --> 00:09:28,970 Instead of jumping, let's try to make the character faster and faster the more pickups they picked 133 00:09:28,970 --> 00:09:29,450 up. 134 00:09:30,320 --> 00:09:33,500 So click on jump and press delete to get rid of this node. 135 00:09:34,660 --> 00:09:39,850 Now we can drag off from the character again and look for the character movement component we talked 136 00:09:39,850 --> 00:09:40,840 about before. 137 00:09:45,180 --> 00:09:50,820 Here we can drag off, and here we can drag off and look for set max walk speed. 138 00:09:56,870 --> 00:10:02,060 This way we can only set a flat value, but we want to get the current max walk speed and add to it. 139 00:10:02,060 --> 00:10:05,510 So drag off again and get max walk speed. 140 00:10:10,640 --> 00:10:15,860 We now want to add a value here, so drag off and input the plus icon. 141 00:10:15,860 --> 00:10:17,930 This will give you the add node. 142 00:10:19,840 --> 00:10:23,470 And here we can just put in a number that we want, for example 500. 143 00:10:24,430 --> 00:10:26,800 And then connect this to the max walk speed. 144 00:10:27,190 --> 00:10:32,530 All this does is get the current max walk speed, add 500 to it and set that as the new speed. 145 00:10:33,490 --> 00:10:36,760 We want to clean this up a little bit though, so we drag this over. 146 00:10:37,510 --> 00:10:40,960 Uh, we can select both of these and press Q to align them. 147 00:10:41,860 --> 00:10:43,150 Move them up. 148 00:10:44,960 --> 00:10:50,330 And then we can double click on this line to create a reroute node and move it over here as well. 149 00:10:50,330 --> 00:10:55,340 Again, we can select both of these by holding Ctrl and then pressing Q to align them. 150 00:10:56,630 --> 00:10:58,790 And let's see if this works out or not. 151 00:11:01,640 --> 00:11:05,450 And as you can see, we get faster and faster the more pickups we collected. 152 00:11:09,810 --> 00:11:15,330 One thing we're doing here that is bad practice is just writing the 500 here, because it can be very 153 00:11:15,330 --> 00:11:17,910 hard to understand what this 500 actually stands for. 154 00:11:19,900 --> 00:11:22,840 This is one instance where variables will come in handy. 155 00:11:23,410 --> 00:11:28,210 A variable is basically a named space in memory that can change the value over time. 156 00:11:28,510 --> 00:11:32,020 And here on the bottom left we can see the variables area in our blueprint. 157 00:11:34,600 --> 00:11:38,890 We can click on plus to add a new one and set a name to it. 158 00:11:39,560 --> 00:11:42,710 In this case speed increase. 159 00:11:44,750 --> 00:11:47,180 There are also different types of variables. 160 00:11:48,530 --> 00:11:51,890 Blueprints are based on C plus plus, so these are strictly typed. 161 00:11:52,930 --> 00:11:55,690 In this case, we want to use a floating point number. 162 00:11:58,330 --> 00:12:00,340 We then need to click on compile. 163 00:12:00,340 --> 00:12:03,670 And here on the bottom right we can see the default value. 164 00:12:04,120 --> 00:12:06,070 We want to set this to 500. 165 00:12:09,650 --> 00:12:13,130 Now you can click on here and drag off into the blueprint. 166 00:12:13,970 --> 00:12:16,790 Then you can pick between Gatsby decrees or set speed increase. 167 00:12:16,790 --> 00:12:18,020 We want to get it. 168 00:12:18,860 --> 00:12:22,610 And now we can just connect this here instead of using the 500 that way. 169 00:12:23,030 --> 00:12:25,940 And this makes it a lot easier to understand what is happening here. 170 00:12:27,240 --> 00:12:27,660 Again. 171 00:12:27,660 --> 00:12:32,130 We can reroute here again to make things cleaner and press Q. 172 00:12:33,940 --> 00:12:38,050 And just to confirm, we can see that everything still works the same way as it did before. 173 00:12:41,940 --> 00:12:46,980 So this part with the variable types can be quite overwhelming and will take some time to get used to. 174 00:12:47,010 --> 00:12:51,150 However, this is not just an Unreal Engine thing, but a general computer science thing, so it definitely 175 00:12:51,150 --> 00:12:53,340 makes sense to learn and understand this over time. 176 00:12:55,990 --> 00:13:00,430 One more great thing about these variables is that we can make these instance editable. 177 00:13:01,190 --> 00:13:02,900 We just have to check here. 178 00:13:04,780 --> 00:13:06,520 And then press on compile. 179 00:13:07,970 --> 00:13:15,050 Now when we go out into the map, we can click our spheres and we can see the speed increase value showing 180 00:13:15,050 --> 00:13:15,860 up here. 181 00:13:15,860 --> 00:13:18,320 And we can change this on a per instance basis. 182 00:13:18,320 --> 00:13:18,890 Now. 183 00:13:18,890 --> 00:13:21,830 So for example we can have both of these at 500. 184 00:13:21,830 --> 00:13:25,760 But we might want only this sphere to add 5000. 185 00:13:26,650 --> 00:13:30,490 So we can easily change this and start test playing right away. 186 00:13:31,120 --> 00:13:34,810 So just like before these add 500 but this one adds 5000. 187 00:13:40,190 --> 00:13:45,680 This is an easy way for us to expose variables so we can change them later easily here, or even have 188 00:13:45,680 --> 00:13:50,360 a game designer come in and only change these values without having to understand code and blueprints. 189 00:13:53,150 --> 00:13:55,670 There are still improvements we can make here. 190 00:13:55,670 --> 00:14:00,290 For example, calling all of this in the pickup is not the best practice, and it would be better to 191 00:14:00,290 --> 00:14:02,360 create a function on top of the character. 192 00:14:02,360 --> 00:14:03,770 So let's do that. 193 00:14:03,770 --> 00:14:07,820 Open up the content drawer and open up the third person character. 194 00:14:08,860 --> 00:14:09,400 In here. 195 00:14:09,400 --> 00:14:11,740 On the left side we see the functions area. 196 00:14:11,740 --> 00:14:13,570 Click on plus to add a function. 197 00:14:14,230 --> 00:14:17,050 We're going to call this increase speed. 198 00:14:19,010 --> 00:14:22,070 And in here we basically want to do the same thing again. 199 00:14:22,340 --> 00:14:24,950 Drag the character movement component in here. 200 00:14:25,500 --> 00:14:29,040 And set max walk speed. 201 00:14:34,180 --> 00:14:43,000 We can also copy and paste this and then get max walk speed and again drag off here and add the plus 202 00:14:43,000 --> 00:14:44,920 icon for the add node. 203 00:14:46,840 --> 00:14:49,360 And in this case we don't want to use 500. 204 00:14:49,660 --> 00:14:50,950 We just want to connect this here. 205 00:14:50,980 --> 00:14:56,080 First connect this as well and clean it up a little bit. 206 00:15:02,610 --> 00:15:06,210 What we want to do here instead is get an input from the function. 207 00:15:06,480 --> 00:15:09,600 So we can click here and increase speed and add an input. 208 00:15:10,200 --> 00:15:16,650 This should be speed, amount and change the type to floating point number. 209 00:15:19,850 --> 00:15:22,130 Now we can simply connect this down here. 210 00:15:22,640 --> 00:15:25,580 But you can see the lines are crossing and it's not very pretty. 211 00:15:26,210 --> 00:15:32,450 We can actually hold control and click here to change where the lines are going. 212 00:15:33,070 --> 00:15:37,150 And move this down and then connect this here, which makes it a lot cleaner. 213 00:15:38,300 --> 00:15:43,910 Now we want to call this function in the pickup so we can get rid of all of this. 214 00:15:45,110 --> 00:15:46,910 And this as well. 215 00:15:47,030 --> 00:15:51,860 And just call increase speed, which we just created. 216 00:15:54,970 --> 00:15:57,700 And here we can again just use our speed increase variable. 217 00:16:00,460 --> 00:16:01,870 And put it in here. 218 00:16:06,610 --> 00:16:08,410 And start test playing. 219 00:16:11,000 --> 00:16:15,650 Yeah, so everything still works the same way, but it's a lot cleaner and better practice. 220 00:16:17,990 --> 00:16:21,770 Of course, there are still many more things we can learn about Blueprint Visual scripting because the 221 00:16:21,770 --> 00:16:23,840 possibilities are basically endless. 222 00:16:23,870 --> 00:16:28,370 However, this is just enough so you can start following along with the other sections of the course, 223 00:16:28,910 --> 00:16:31,100 and you'll learn more and more as we continue. 224 00:16:31,610 --> 00:16:35,570 In the next section, we'll talk about some keyboard shortcuts and some small tips and tricks. 21887

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.