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.