Welcome everyone in this video Our goal is to create some script inside of our Player Controller to make our white magic menu come on and off the screen at will. We're going to be starting off in our project settings here. So in your toolbar area, find your settings button, and in your settings drop down, click on project settings, and you may have remembered this step for bringing on and off our black magic menu. But over here on the left hand side, find your input category. And just as we did with creating a black magic menu, event action mapping, we are going to create a white magic menu action mapping here so click this plus button again note that this is going to be an action mapping, not an access mapping. Click this plus button.
We will name this new mapping white magic menu I'm going to bind this to I'm going to go with the right control key on the keyboard. And the reason I'm going with the right control key is because I have one of those longer keyboards here. So I've got my up down left right arrows kind of on the right hand side of my keyboard, and the right mouse control key is directly adjacent to that. So that's gonna kind of serve as my left shoulder button, which is the other key I want to bind to this. I'm going to click right here, this plus button to add an action mapping for this group. And I also want to bind this to the left shoulder button on a gamepad controller.
With that done, we can just close out of our project settings there's no Save button or anything here. And Next I am going to jump into our Player Controller Metroidvania asset that is in this directory right here content Metroidvania blueprints friends. Work. Let's double click on this guy to open it up. And we're going to be doing some work over here in the Event Graph. Find wherever you have Event Begin Play.
Currently, we are doing Event Begin Play, and then we're creating a reference to our Blackmagic menu. We want to do the same with our white magic menus. So a way we can do this and keep this nice and neat and organized is off of Event Begin Play. Let's hold down the S key and left click to bring in a sequence node. I'm going to wind our event through here. And now off of one event, Begin Play I can do this and then also do this off of the event one output, I'm going to create another widget.
And the widget that I'm going to create down here is going to be our w BP white magic menu right there. And then I'm gonna Right click on our return value here, right click, and we're going to promote this to a variable. And I will call this w BP underscore, W magic menu. And just to keep things nice and organized, I'm going to drag this up in my list of variables and drop it right about there. And then I'm going to left click and drag around these two nodes, tap that C key, and type W, magic menu, reference. So now we are storing our white magic menu inside of a variable and we're going to need that for some steps upcoming here.
Okay, so that is out of the way. Let's come under where we are showing and hiding our black magic menu. You may remember this monster script. It's actually not that bad that we created earlier. Well, we're going to do something very similar for creating rather I should say, showing our own white magic menu. So the good news here is we can copy a whole lot of nodes.
There is some stuff over here for showing the Starburst upon selection, we're not gonna worry about that just yet. I'm talking about this main block of nodes right here. Try to frame it up. There we go. So let's left click and drag around all these nodes. Note that I am skipping that event node at the very beginning.
So select all of these from our getting of our HUD all the way over to our setting the input modes. So all those are selected, I'm going to hit Ctrl C to copy and I'm going to come down in my Event Graph a little bit, find some space right in here, and I'm going to hit Ctrl V. And I am going to extend out this comment box right here because we're going to need a little bit more space inside here. And then I'm going to drag these on over to the rights like so. Okay, so next, I'm going to change the name of our comment box here from show hide black magic menu to white magic menu. And we need an event. To kick this all off.
Well, we just created one in our project settings. So let's right click here and type in white magic menu there is our action event. And the reason I created this bit of space between our event node here and the rest of our script, is we need to do a special check at the very front of this. But before we do that, and before I forget, I wanted to make note here that with this input action white magic menu note in here, you need to select this node. And over in the Details panel. We've got this execute one pause that is currently unchecked, we need to make sure that this is checked.
And the reason again is because when we press this button while the game is running, we are going to be pausing the game. And the only way that we can have this release event fire off and be detected is if we have this set to be executing when the pause so very important step there. Okay, so with all this in here, what is the thing that we need to do a check for? Well, I need to firstly right click and bring in a Get Player Character node. off of this let's drag out and see if our BP player let's do our cast to our BP player. So often pressing we're going to cast to our BP player like so.
And the reason we're casting to our BP player is because inside of our BP player, if I drag off here, we can find a variable called w magic ready? We're going to get b w magic ready, that's Boolean w magic ready. And then we're going to drag off of here and plug this into a branch node. Make sure we got our execution wires hooked up like so. So why are we doing this? Why are we doing a check for this before we can then even do the rest of this script over here.
The reason being is because unlike our black magic skills, our white magic skills are gonna have some cooldown associated with them. So we're going to make it so that the only time that you can bring on your white magic menu is if we aren't already using some white magic. It is basically being unused and we can swap out to a different white magic. So once we are finished turning into mist, for example, in our midst has expired returned back into human form. This is Then going to be set back to Yes, you can use white magic again. And that is the only time we want to be able to show or hide this white magic menu.
Okay, so if this is true that our white magic menu is ready to be brought on, meaning we're not transformed into mist or so forth. If that's true, we're going to bring in another sequence node. And off of this then zero pin. We're going to then hook this into the rest of our script. Now currently, it's meant to Add to Viewport RB magic menu, but we're gonna swap some of these variables out in just a little bit. What are we going to do off of this then one pin?
Well, that remains to be seen. We'll get to that in just a moment. But before we get any further with this off of this false branch, if our white magic is not ready, I'm going to drag off here and type in play sound 2d. I kind of want to have a sound play, if that turns to be false, so the sound I want to slot in here is going to be VR underscore negative. This one right here VR negative Q. And again, note that this is in our engine content.
And I've showed you multiple times how to get there. If you go to View Options and show engine content, you too can make use of this sound. So I'm going to plug that into there. And then I'm going to right click on this pin promote this to a variable and I will call this s FX underscore action dis allowed action disallow that sounds rather heavy handed. I am going to bring on some of the other options here by clicking this little drop down. I'm going to set the volume multiplier here to the point two, three, a little bit quieter than that.
Defaults in that is good to go. There. Okay, so I could probably bring these a little bit closer now the rest of these nodes. Before we go on to what happens when we release our white magic menu button, let's swap out some of our variables here in this chain. Because remember, we copy these all from our black magic menu, or from our black magic script right up above. So here we're saying we want to hide our w BP HUD and show our w BP black magic menu.
Well, that's not really the case anymore. We want to bring on our w BP w magic menu. So we're gonna get that and now simply kind of swapping out our wires here. So I want to add that the viewport we can mix that while holding down ALT and left clicking will actually just let me do it. Z here to bring those all back on, because it deleted them all I kind of want you to see where all these wires are going to end from. So I'm going to plug this into our play animation.
And then I'm going to drag out of my w magic menu and instead of the Big Magic menu intro, I'm going to drag out of here and look for W magic intro there is my w magic intro animation. Let's plug that into the in animation here. And lastly, we need to make sure that we take our w magic menu and plug this into the Remove from Parent all the script down here is going to be when we release the button it's gonna eventually plug into here and continue forth. Okay, and we don't need this be magic menu intro animation so we can delete that guy out Caleb's script, scroll over to the right a little bit and Here we've got our w BP BP magic menu. Let's bring in w BP w a magic menu, get that. And let's make sure that we make that our widget to focus on right there instead of our be magic menu.
Okay, so that is looking pretty good. Now let's kind of zoom out here scroll wheel all the way on back. And we need to work off of the release button of our input action white magic menu. So what I want to do is I'm going to hold down the G key, and left click and I'm going to bring in a gate node. Now explain how this works. You haven't used one of these in a little bit.
When we release our button here. We're going to plug this into our gates. A gate is kind of self explanatory, like you know what a gate is. a gate is a barrier of sorts. You walk up to a gates, it could be locked. It could be open, can you proceed?
Well, how do we know if it is open or closed? Well, we can plug things in here to determine if this thing is open or closed. By default, we're saying that this gate, this bit of script beyond this barrier right here is going to be closed, meaning that even if we release this key right now, it would be considered close and this would not fire off in thusly execute the script beyond. What do we want to have open this gate? Well, when I press the white magic menu button, when I press it, we're going to be doing this check to see if the white magic is met is ready. And then we got a sequence here and off of my event, one output I am going to then plug this into the opening of our gate to say yes, our gate is now open and capable of being traversed upon or beyond, I should say So that the rest of the script can fire off when we release the button.
Let me just bring in a reroute node here, kind of reposition this a little bit. Okay. So as soon as we press the button, we're going to send a signal right here from our sequence node that opens our gate. After we exit our gate, I'm going to bring in a sequence node and out of our then zero pin, I'm going to plug that into our adding of our HUD back to our viewport and we're going to continue forth like so. playing some sounds on pausing the game, etc. Now the reason I added a sequence node right here is because off of our then one pin right here, I'm going to plug this into our closing of the gait let me just bring in a couple of reroute nodes here by double clicking.
So you can sort of see that flow. And then I'll make it so that we have closed our gate once again and it can only be traversed upon again, once we press the our, our action key here and open it up once again. Okay, so I think that should just about do it here. Let's just kind of take a quick Gander, to make sure everything is right here. Let's compile Firstly, to make sure everything in our script looks good to go. Let's save.
I'm going to jump in and play here. Okay, I'm gonna hit my right control key. There is my white magic menu release. Let me try it on my control pad as well. The left shoulder button looks pretty good there is well. Now I just exited out here and I have a little error.
Let's see what the error could be. Alright, and it looks like this is an error. You probably did not encounter because I did something, quote unquote special. While I was exiting out of my game when I had my w magic menu up, I was actually pressing on the arrow keys. I had the right arrow key held down when I then escaped in this is how I got that error. I bet if I jump back to my PC Metroidvania here and I went over to where I'm doing this hiding the acquired Let me see that Message Log error exists none.
Okay, and Roof Repair, okay, if I learned skill right there, if I jump back here into my PC Metroidvania right where I'm hiding my skill Widget Blueprint and I'm doing all of this stuff. If I drag off of here and type in is valid, the question mark version. Let me just kind of move this all over to the right here. Little bit and I sneak this in up there that should fix that issue again, you probably are not seeing this issue because I did a very specific thing with my keys there or to get that issue to arise this message issue. But if you are getting this sort of an access none trying to read w BP learned skill sneak in and is valid node into this section of your script here in PC Metroidvania that should clean that up. Something else I wanted to point out here when I click play.
Okay, so I'm gonna hold down my button to bring up my white magic menu. If I use my w a s and D keys. Look at my HUD area in the upper right hand corner. It is not showing the appropriate icon. Don't worry about that for now that is a known issue that we'll get fixed up in a future video here. Anyways guys that will do it all for this video still more work to be done but we will see you in the next one