Skill Acquire - Script #4

17 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€95.85
List Price:  €134.19
You save:  €38.34
£79.54
List Price:  £111.35
You save:  £31.81
CA$143.73
List Price:  CA$201.23
You save:  CA$57.50
A$159.93
List Price:  A$223.91
You save:  A$63.97
S$135.54
List Price:  S$189.77
You save:  S$54.22
HK$777.83
List Price:  HK$1,089
You save:  HK$311.16
CHF 89.34
List Price:  CHF 125.09
You save:  CHF 35.74
NOK kr1,131.88
List Price:  NOK kr1,584.68
You save:  NOK kr452.80
DKK kr715.08
List Price:  DKK kr1,001.15
You save:  DKK kr286.06
NZ$176.75
List Price:  NZ$247.46
You save:  NZ$70.70
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳11,945.33
List Price:  ৳16,723.94
You save:  ৳4,778.61
₹8,493.77
List Price:  ₹11,891.62
You save:  ₹3,397.85
RM450.75
List Price:  RM631.07
You save:  RM180.32
₦154,938.50
List Price:  ₦216,920.10
You save:  ₦61,981.60
₨27,824.38
List Price:  ₨38,955.25
You save:  ₨11,130.86
฿3,419.79
List Price:  ฿4,787.84
You save:  ฿1,368.05
₺3,519.01
List Price:  ₺4,926.76
You save:  ₺1,407.74
B$608.53
List Price:  B$851.97
You save:  B$243.44
R1,830.80
List Price:  R2,563.19
You save:  R732.39
Лв187.32
List Price:  Лв262.25
You save:  Лв74.93
₩144,627.53
List Price:  ₩202,484.33
You save:  ₩57,856.80
₪365.39
List Price:  ₪511.57
You save:  ₪146.17
₱5,882.91
List Price:  ₱8,236.31
You save:  ₱2,353.40
¥15,643.93
List Price:  ¥21,902.13
You save:  ¥6,258.20
MX$2,007.58
List Price:  MX$2,810.70
You save:  MX$803.11
QR364.41
List Price:  QR510.19
You save:  QR145.78
P1,381.63
List Price:  P1,934.33
You save:  P552.70
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£5,087.81
List Price:  E£7,123.14
You save:  E£2,035.32
ብር12,764.56
List Price:  ብር17,870.89
You save:  ብር5,106.33
Kz91,790.82
List Price:  Kz128,510.82
You save:  Kz36,720
CLP$98,905.10
List Price:  CLP$138,471.10
You save:  CLP$39,566
CN¥729.56
List Price:  CN¥1,021.42
You save:  CN¥291.85
RD$6,087.13
List Price:  RD$8,522.23
You save:  RD$2,435.09
DA13,485.25
List Price:  DA18,879.89
You save:  DA5,394.64
FJ$231.62
List Price:  FJ$324.28
You save:  FJ$92.66
Q770.23
List Price:  Q1,078.35
You save:  Q308.12
GY$20,913.67
List Price:  GY$29,279.97
You save:  GY$8,366.30
ISK kr13,911.60
List Price:  ISK kr19,476.80
You save:  ISK kr5,565.20
DH1,006.07
List Price:  DH1,408.53
You save:  DH402.46
L1,836.70
List Price:  L2,571.46
You save:  L734.75
ден5,900.06
List Price:  ден8,260.33
You save:  ден2,360.26
MOP$800.26
List Price:  MOP$1,120.39
You save:  MOP$320.13
N$1,840.36
List Price:  N$2,576.58
You save:  N$736.22
C$3,678.42
List Price:  C$5,149.94
You save:  C$1,471.51
रु13,597.49
List Price:  रु19,037.04
You save:  रु5,439.54
S/372.23
List Price:  S/521.13
You save:  S/148.90
K405.36
List Price:  K567.52
You save:  K162.16
SAR375.62
List Price:  SAR525.88
You save:  SAR150.26
ZK2,766.46
List Price:  ZK3,873.15
You save:  ZK1,106.69
L477.10
List Price:  L667.96
You save:  L190.86
Kč2,408.98
List Price:  Kč3,372.68
You save:  Kč963.69
Ft39,689.03
List Price:  Ft55,566.23
You save:  Ft15,877.20
SEK kr1,103.13
List Price:  SEK kr1,544.43
You save:  SEK kr441.30
ARS$102,160.40
List Price:  ARS$143,028.65
You save:  ARS$40,868.24
Bs690.76
List Price:  Bs967.10
You save:  Bs276.33
COP$435,928.80
List Price:  COP$610,317.76
You save:  COP$174,388.96
₡50,434.81
List Price:  ₡70,610.75
You save:  ₡20,175.94
L2,537.51
List Price:  L3,552.62
You save:  L1,015.10
₲779,455.88
List Price:  ₲1,091,269.42
You save:  ₲311,813.53
$U4,474.38
List Price:  $U6,264.31
You save:  $U1,789.93
zł408.66
List Price:  zł572.14
You save:  zł163.48
Already have an account? Log In

Transcript

Welcome once again everyone in the last video we went about creating this Player Controller and inside of our Player Controller we added some script that is going to kick off when we call this custom events. In this video what we're going to do is we're going to write some script to respond accordingly such as high to skill mesh play a visual effect and sound effect. Whenever we detect our interact line trace you remember we did that in our BP player, whenever we detected that line trace has hit a Dyess and when our skill can be obtained, okay, and we're so we're gonna kind of connect some of the dots here to make this show acquired skill Custom Event actually fire off as well. Okay, so we're gonna start off you're working inside of our BP skill double jump. If you don't recall how to get here that is in our Metroidvania blueprints actually folder BP skill double jump, that's kind of our guinea pig here for all the different skills that we're looking to acquire.

So let's work within here. The first thing I want to do is I want to create a function called player acquired skill effects. So right over here along the left hand side where we've got our function section, let's click the plus function button. And I will call this player acquired skill FX. Okay, and this function is as you would imagine, it's going to play off some, some effects and emitter play a sound is etc. So the first thing I want to do when this function gets called is I want to tell our w BP notifier.

Here you can drag and drop that into your graph. We're going to get that and I'm going to tell that to remove you want to select Remove from Parent we want our notification to disappear from the screen and by that, I mean, we want our message to disappear from the screen. Okay. The other thing I want to be able to do, first of all, let me back this up a little bit. If you don't see this variable right here, make sure that you click right here to show inherited variables. That's how you can see these group of variables in our interactive object variables category.

So we're going to remove that from the parent. The next thing we're going to do is drag off into a spawn emitter at location. The emitter that I would like to spawn is going to be p underscore or pile. Explosions success. This is one found in the Infinity Blade effects pack and again, you can use any one that you want, but I thought this one seemed rather appropriate. So that's the one I'm going to select.

Now I need to feed this a location. So what I'm going to do is I'm going to get my skill mesh here. That is, if I just tap the F key, I can focus up on it. So we're talking right here, the sort of book mesh right there. I'm going to get my skill mesh. I'm going to drag off of that and say get world location.

That's the location that I want to spawn this emitter at. And I'm going to play this emitter at a slightly larger scale. So I'm going to set the scale here to be two for the x, y and the Z to their, to their, into their. Okay, then I'm going to drag off of here and I'm going to play sound to D the sound that I would like to play, I will slot in my SF x skill acquired this sound effect right down here. Let's drag and drop that right on top of the sound and automatically hook that up. And I'm actually going to click this drop down and choose the volume multiplier, I'm going to set that to be three times as loud to in, crease, the sound of that.

And then off of this, I am going to drag off and I am going to actually I'm not going to drag off here, I want to destroy several components the moment that we acquire this skill, so I don't want to destroy the actor just yet. I want to destroy some components. The ones that I want to destroy are going to be our skill mesh, our skill VFX some dragon all these from the components panel, our skill light and our interact collider because we don't want to be able to interact with this once we have collected the skill So we could drag off of any one of these and simply say d stroy component. And hook these up like so. I'm gonna align all these, I'm just gonna left click drag, right click, I'm gonna align these. All right, and then I'm going to right click these all do alignment once again and distribute vertically to make them all nice and organized here.

And then I can plug them all into the exact same destroy component node. Okay, so that is going to be my player acquired skill effects function. There it is on screen for you all in case you want to pause the video here and get a good look at what that functions all going to be about. Okay, and with that, I'm going to Compile and Save. Now the next thing I want to do here is create our acquired skill script. So I'm going to jump out of our function here in into the event group.

That's where we're going to make this happen. We've got our show message, our hide interact message, I'm going to come on down a little bit. And I want to grab an event to start us off here and the one that I'm going to be looking to add if I right click is going to be object interacted with. Now you can see as I'm starting to type things in here, I've got object interacted with call function. I've got object interact, acted with interface call, and I've also got an add event for an event object interact with this is the one I want. Now, where's this coming from?

Again? Well, this is that Blueprint Interface that we added in our blueprint in our class settings. You may have recalled that we added this into our parent blueprint before here is the inherited interfaces BPI interact that we created earlier. And we were creating a call to that inside of our BP player in our interact script right over here, we were shooting out a line trace and then our line we were checking to see if it hit anything. And then we were calling for object interacted with to then fire out, which is then reaching over to our BP skill double jump in this case, and this will fire out. Okay, so what I want to do next is I want to bring in a reference to our player.

We're going to get that and I'm going to drag out of this and say has double jump we're gonna get has double jump inside of our player blueprint. This is why I've got a lot of tabs open along the top. inside of our player blueprint we have a boolean value known as has double jumped has our player acquired the double jump skill by default It is false. Jumping back to VP skill double jump. We are going to evaluate this drag out of this type in branch. To see if that is true.

Does he already have the double jump skill? If it is true, I'm just going to simply print a string out that says player already has double jump, exclamation point. And if it's false, I'm then going to drag out my player type in has double jump. This time we're going to set has double jump. So this is where we're going to interact with this skill Dyess and then we're going to say does he have double jump? No.

Okay, well, now he does have it so we're just gonna set that boolean value to true on our player. Okay, and also out of our player, going to drag that away. In type in skill acquired this is this innum we created this even before this set skill acquired is what we're looking for. And we also want to set this skill acquired to be double jump. And you remember this is going to be important because over in our w BP skill acquired. If I jump on over to the Graph tab here we've got all kinds of functions that if you double click on them, we're using whatever this value is and our skill acquired at noon.

We're wondering what that is to drive what should be populated on our screen things like what should the man accost be? What should the title of the screen be all these sorts of things, what should the image be etc, etc. That is why setting this he numerous Variable right here is so critical jump jumping back to a BP skill double jump once again. Okay, so once that is finished, we can then drag off of this and we can type in player can't see what I'm typing here, acquired skill effects. This is this function that we just created right here. This is gonna play some particles in a sound and destroy some of those components.

Okay, keeping our flow of execution here, I'm going to drag out a wire, bring in a delay, and I'm going to set my delay here to be point seven, five seconds why point seven five seconds because I'm going to leave myself a node common here by right clicking node comment. That's the amount of time it takes for the VFX On skill collection to finish playing by that I'm talking about this skill, this emitter right here, it takes about three quarters of a second for that to finish up. So just kind of want to see that before we go on to the next thing here. So we're gonna delay for that amount of time. Then I'm going to create a widget. And the widget here that I want to create is our w BP skill acquired.

Okay, and then after that, what I want to do is I'm going to firstly right click, and type in Get Player Controller. And I'm going to drag out of this next, and we're going to cast to our Player Controller that we just created, hooking this wire in like so. The reason I am doing this is because inside of our Player Controller here, we just created this variable right here that is currently empty w BP learn skill. So jumping back to our BP skill double jump, I'm going to drag out of our Player Controller here. And I'm going to type in set w BP skill learn like this hooking in our execution wire like this. And the thing that I want to set in here is this created widget.

Now the reason I am setting this variable from here is because eventually in the next video, what I'm going to do is after we create this widget and display it to the player, I am going to destroy it from our Player Controller blueprint. And in order to do that, I need to pass this created widget here to our Player Controller in order to Do it cleanly from there. Okay, so then last step here what I need to do I need to drag off of here. And sorry, not just drag right off of here, I want to show our acquired skill. Okay, so you remember in our PC Metroidvania, we've got this custom event for show acquired skill. I now want to call that from our BP skill double jump.

So in order to do that, I need to drag out of our SPC Metroidvania and type in show acquired skill, like so. And let me see if I can bring this monstrous bit of scripted Well, it's not that monstrous on the screen. Let me just kind of pan through it so you can get a good Gander as to what we've all done here. event object interacted with, make sure it's the event and it's got that icon there. Make sure you check this has double jump Set your skill acquired enough from the player to double jump. Then recalling this particle effect, not well dysfunction that's going to spawn particle effect and sound effect, then we're going to delay for three quarters of a second, we're going to create this skill acquired Widget Blueprint.

We're going to push that into the variable in our PC Metroidvania. And then we're going to call our show acquired skill custom events to fire out here inside of PC Metroidvania. So with that, I'm going to jump back to bps skill, double jump, and Compile and Save. And I should be able to jump in and play right now. And there's going to be some missing things just yet. We're not actually going to see this w BP skill acquired just yet, but our game should pause.

So let me just jump in and play quickly. Our player is going to overlap this volume right here. This is going to show our message learned skill, I'm going to press the the B button, or rather, I'm going to be pressing the right arrow key in order to interact with this. And so I have in our game is pause, okay, that's where we should be at this point, because there's still some more work to be done. If I hit escape from here, I do have some warning. So let's check out what this warning message is saying.

Attempted to access skill mesh via property, blah, blah, blah. Okay, so if we click on our BP skill base right here, that'll actually jump us to the appropriate blueprint where this error is happening. And I see what's going wrong here. We've got this timeline that's moving our skill mesh. In this case, if I click on this and tap the F key to frame up on it, this book is kind of bobbing this up and down over time, right? Well, when we collect this skill, we were actually destroying that components.

If I recall correctly inside of our BP skill double jump, our player acquired skill FX here is the function in which we are destroying that skill mesh. And what that error is saying essentially is, hey, we are trying to still Bob up and down, but we don't know where you are anymore skill mesh, so that's why it's throwing the error. So something we can do here to fix this is I can just back up the skill mesh a little bit, drag off of this and type in is valid. And use this question mark version, this node right here. And then just reroute your execution wires, like so. This is basically a way of checking, hey, skill mesh, are you still around?

Are you still valid if you are, keep moving up and down if you're not, don't keep moving up and down. So let's Compile and Save. jump in and play once again and try that interaction. Okay, the message appears tapping the interaction button. The game pauses as it should I hit escape, and there are no warning messages. So that is good.

Okay, a couple more videos to go through here to see this come to fruition. We are not done yet. So let's keep the momentum rolling. I'll see you guys in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.