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
€92.72
List Price:  €129.81
You save:  €37.09
£79.26
List Price:  £110.97
You save:  £31.71
CA$135.49
List Price:  CA$189.69
You save:  CA$54.20
A$153.49
List Price:  A$214.89
You save:  A$61.40
S$134.92
List Price:  S$188.90
You save:  S$53.97
HK$782.50
List Price:  HK$1,095.53
You save:  HK$313.03
CHF 90.16
List Price:  CHF 126.23
You save:  CHF 36.07
NOK kr1,085.06
List Price:  NOK kr1,519.13
You save:  NOK kr434.06
DKK kr691.90
List Price:  DKK kr968.69
You save:  DKK kr276.78
NZ$167.41
List Price:  NZ$234.39
You save:  NZ$66.97
د.إ367.19
List Price:  د.إ514.08
You save:  د.إ146.89
৳10,980.73
List Price:  ৳15,373.46
You save:  ৳4,392.73
₹8,335.04
List Price:  ₹11,669.39
You save:  ₹3,334.35
RM472.40
List Price:  RM661.38
You save:  RM188.98
₦139,532.04
List Price:  ₦195,350.44
You save:  ₦55,818.40
₨27,813.53
List Price:  ₨38,940.06
You save:  ₨11,126.52
฿3,638.31
List Price:  ฿5,093.78
You save:  ฿1,455.47
₺3,237.16
List Price:  ₺4,532.16
You save:  ₺1,294.99
B$501.53
List Price:  B$702.17
You save:  B$200.63
R1,888.66
List Price:  R2,644.21
You save:  R755.54
Лв180.76
List Price:  Лв253.07
You save:  Лв72.31
₩134,741.70
List Price:  ₩188,643.77
You save:  ₩53,902.07
₪367.71
List Price:  ₪514.81
You save:  ₪147.10
₱5,617.33
List Price:  ₱7,864.49
You save:  ₱2,247.16
¥15,132.45
List Price:  ¥21,186.03
You save:  ¥6,053.58
MX$1,658.17
List Price:  MX$2,321.51
You save:  MX$663.33
QR364.88
List Price:  QR510.84
You save:  QR145.96
P1,378.06
List Price:  P1,929.34
You save:  P551.28
KSh13,256.67
List Price:  KSh18,559.87
You save:  KSh5,303.20
E£4,744.14
List Price:  E£6,641.99
You save:  E£1,897.84
ብር5,687.29
List Price:  ብር7,962.44
You save:  ብር2,275.14
Kz83,433.85
List Price:  Kz116,810.73
You save:  Kz33,376.88
CLP$98,290.17
List Price:  CLP$137,610.17
You save:  CLP$39,320
CN¥722.08
List Price:  CN¥1,010.95
You save:  CN¥288.86
RD$5,924.54
List Price:  RD$8,294.60
You save:  RD$2,370.05
DA13,479.97
List Price:  DA18,872.49
You save:  DA5,392.52
FJ$225.66
List Price:  FJ$315.94
You save:  FJ$90.27
Q780.13
List Price:  Q1,092.22
You save:  Q312.08
GY$20,949.30
List Price:  GY$29,329.86
You save:  GY$8,380.56
ISK kr13,941.60
List Price:  ISK kr19,518.80
You save:  ISK kr5,577.20
DH1,013.74
List Price:  DH1,419.27
You save:  DH405.53
L1,764.37
List Price:  L2,470.19
You save:  L705.82
ден5,702.11
List Price:  ден7,983.18
You save:  ден2,281.07
MOP$806.29
List Price:  MOP$1,128.85
You save:  MOP$322.55
N$1,909.24
List Price:  N$2,673.01
You save:  N$763.77
C$3,682.20
List Price:  C$5,155.22
You save:  C$1,473.02
रु13,347.49
List Price:  रु18,687.02
You save:  रु5,339.53
S/372.08
List Price:  S/520.93
You save:  S/148.85
K382.87
List Price:  K536.04
You save:  K153.16
SAR375.15
List Price:  SAR525.22
You save:  SAR150.07
ZK2,481.24
List Price:  ZK3,473.83
You save:  ZK992.59
L460.94
List Price:  L645.33
You save:  L184.39
Kč2,346.52
List Price:  Kč3,285.22
You save:  Kč938.70
Ft36,532.34
List Price:  Ft51,146.74
You save:  Ft14,614.40
SEK kr1,069.05
List Price:  SEK kr1,496.71
You save:  SEK kr427.66
ARS$85,802.56
List Price:  ARS$120,127.02
You save:  ARS$34,324.45
Bs691.35
List Price:  Bs967.92
You save:  Bs276.56
COP$386,901.39
List Price:  COP$541,677.43
You save:  COP$154,776.03
₡50,320.66
List Price:  ₡70,450.94
You save:  ₡20,130.27
L2,469.73
List Price:  L3,457.73
You save:  L987.99
₲739,686.52
List Price:  ₲1,035,590.72
You save:  ₲295,904.20
$U3,756.16
List Price:  $U5,258.77
You save:  $U1,502.61
zł399
List Price:  zł558.62
You save:  zł159.61
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.