Black Magic Menu - Script #1

15 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
€94.79
List Price:  €132.71
You save:  €37.92
£78.97
List Price:  £110.56
You save:  £31.59
CA$139.89
List Price:  CA$195.85
You save:  CA$55.96
A$153.73
List Price:  A$215.23
You save:  A$61.50
S$134.32
List Price:  S$188.05
You save:  S$53.73
HK$778.26
List Price:  HK$1,089.59
You save:  HK$311.33
CHF 88.57
List Price:  CHF 124
You save:  CHF 35.43
NOK kr1,105.08
List Price:  NOK kr1,547.16
You save:  NOK kr442.07
DKK kr706.99
List Price:  DKK kr989.82
You save:  DKK kr282.82
NZ$170.06
List Price:  NZ$238.10
You save:  NZ$68.03
د.إ367.26
List Price:  د.إ514.17
You save:  د.إ146.91
৳11,906.24
List Price:  ৳16,669.22
You save:  ৳4,762.97
₹8,436.24
List Price:  ₹11,811.08
You save:  ₹3,374.83
RM447.10
List Price:  RM625.96
You save:  RM178.86
₦167,464.25
List Price:  ₦234,456.65
You save:  ₦66,992.40
₨27,687.73
List Price:  ₨38,763.93
You save:  ₨11,076.20
฿3,470.35
List Price:  ฿4,858.63
You save:  ฿1,388.28
₺3,445.98
List Price:  ₺4,824.51
You save:  ₺1,378.53
B$578.68
List Price:  B$810.17
You save:  B$231.49
R1,810.53
List Price:  R2,534.81
You save:  R724.28
Лв185.34
List Price:  Лв259.49
You save:  Лв74.14
₩139,691.42
List Price:  ₩195,573.58
You save:  ₩55,882.15
₪373.67
List Price:  ₪523.15
You save:  ₪149.48
₱5,901.36
List Price:  ₱8,262.14
You save:  ₱2,360.78
¥15,574.86
List Price:  ¥21,805.43
You save:  ¥6,230.57
MX$2,020.46
List Price:  MX$2,828.72
You save:  MX$808.26
QR363.35
List Price:  QR508.71
You save:  QR145.35
P1,355.53
List Price:  P1,897.79
You save:  P542.26
KSh12,948.70
List Price:  KSh18,128.70
You save:  KSh5,180
E£4,969.50
List Price:  E£6,957.50
You save:  E£1,988
ብር12,262.61
List Price:  ብር17,168.15
You save:  ብር4,905.53
Kz91,256.94
List Price:  Kz127,763.36
You save:  Kz36,506.42
CLP$97,119.28
List Price:  CLP$135,970.88
You save:  CLP$38,851.60
CN¥724.58
List Price:  CN¥1,014.45
You save:  CN¥289.86
RD$6,000.34
List Price:  RD$8,400.72
You save:  RD$2,400.37
DA13,341.73
List Price:  DA18,678.95
You save:  DA5,337.22
FJ$227.04
List Price:  FJ$317.87
You save:  FJ$90.82
Q769.16
List Price:  Q1,076.85
You save:  Q307.69
GY$20,834.51
List Price:  GY$29,169.15
You save:  GY$8,334.63
ISK kr13,772.62
List Price:  ISK kr19,282.22
You save:  ISK kr5,509.60
DH995.44
List Price:  DH1,393.66
You save:  DH398.21
L1,819.82
List Price:  L2,547.83
You save:  L728
ден5,825.40
List Price:  ден8,155.79
You save:  ден2,330.39
MOP$798.74
List Price:  MOP$1,118.27
You save:  MOP$319.52
N$1,801.35
List Price:  N$2,521.97
You save:  N$720.61
C$3,666.61
List Price:  C$5,133.40
You save:  C$1,466.79
रु13,462.23
List Price:  रु18,847.67
You save:  रु5,385.43
S/378.10
List Price:  S/529.35
You save:  S/151.25
K400.90
List Price:  K561.28
You save:  K160.37
SAR375.38
List Price:  SAR525.55
You save:  SAR150.16
ZK2,752.36
List Price:  ZK3,853.42
You save:  ZK1,101.05
L471.69
List Price:  L660.38
You save:  L188.69
Kč2,395.79
List Price:  Kč3,354.20
You save:  Kč958.41
Ft38,840.72
List Price:  Ft54,378.57
You save:  Ft15,537.84
SEK kr1,099.74
List Price:  SEK kr1,539.68
You save:  SEK kr439.94
ARS$100,165.56
List Price:  ARS$140,235.79
You save:  ARS$40,070.23
Bs690.96
List Price:  Bs967.37
You save:  Bs276.41
COP$440,690.82
List Price:  COP$616,984.78
You save:  COP$176,293.95
₡50,645.88
List Price:  ₡70,906.26
You save:  ₡20,260.37
L2,517.41
List Price:  L3,524.47
You save:  L1,007.06
₲775,966.15
List Price:  ₲1,086,383.66
You save:  ₲310,417.50
$U4,274.58
List Price:  $U5,984.58
You save:  $U1,710
zł411.21
List Price:  zł575.71
You save:  zł164.50
Already have an account? Log In

Transcript

Welcome back everyone in this video Our goal is to create some script inside of our Player Controller to make our black magic menu come on and off the screen at will. Let's jump right to it. We're going to start out here working inside of our project settings. So jumping back to your main level editor, come into the toolbar settings, we want to access our project settings right there. And over on the left hand side, select your input category, we're going to add a new action mapping, not a new access mapping but a new action mapping. So click this plus button right here we're going to create a new action mapping for black magic menu.

That's a good name for an event that we can fire off and we're going to bind this to a couple of buttons. The first one we are going to bind this to will be our numbers zero on our keyboard and we're also going to add a nother accent. mapping here for this for all you controller people, I want to do one for the right shoulder button gamepad right shoulder. Okay, so with that added, we can exit out of our project set. Well actually, you know, let's keep our project settings here because we're going to be jumping back to this in just a moment. In fact, we're going to be jumping over to the maps in modes category.

In our maps and mode category, we can see that our current Player Controller class here for our project is p c Metroidvania. Now we're going to be adding this bit of script for showing and hiding the Blackmagic menu inside of our Player Controller here are PC Metroidvania. So let's click right here to browse this asset in the Content Browser. That'll jump us over to the appropriate directory. Let's double click on this to open it up and I firstly need to create a reference to our be magic menu. We've got some some screens In here already for showing the acquired skill and hiding the acquired skill blueprint.

I'm just gonna jump over to the right here a little bit, right click and type in Begin Play, we're gonna add an event upon beginning play for Player Controller here, I'm gonna drag off of this type in create a widget. And the widget that I want to create is our B magic menu. And then off of the return value here, I'm not going to drag out instead, I'm going to right click on this return value and promote this created widgets to a variable. And I'm going to name that w BP underscore B magic underscore menu. So once we've created it, we're storing it into a variable. I'll left click drag around this tab that C key and I will say that this is a B magic, menu reference.

That's what this bit of script is reference. That's this bit of script is right here. Okay, so the next thing I want to do here inside of our PC Metroidvania is I want to right click and do a search for black magic. I have already whittled down to two different input action events. I want black magic menu, the one that we just created inside of our project settings. So remember the right shoulder button or the number zero on our keyboard can fire this out.

And I want something to happen when we press either that button or the shoulder button Well, something I want to make sure that I do before I add any script is with this event added. Over in the Details panel. We've got this option for execute when paused that is currently unchecked. For this particular action. We want to make sure that this is checked. Now why because when we press the zero key or the right shoulder button, we are going to be pausing the game in order to decide Play the black magic menu.

And the only way to have this work when I'm pausing it is to ensure that this event can fire off. When pause. This is saying yes, this can still register an event it'll still fire out when the game is paused, make sure that you have that checked. Okay, so what do I want to do when we press this button? Well, what I want to do is I want to right click, I'm going to get HUD. Then I'm going to drag off of this and type in cast to our m v HUD.

And let's link this in as well off of the press event. I'll bring it a little rerouting note here. Now why do I want to do this? Well, in our project settings, in our maps and modes section, our current HUD class is m v HUD and if I click here to browse to this asset in the Content Browser, There it is in this directory, I will double click on it to open it up, you can see that we have an event in here where we are creating our w BP HUD widget and we're adding it to the viewport. Now this is going to be important for this next step. And actually, I need to make an adjustment here inside of our m v HUD, between our creation of the HUD and adding it to the viewport.

I'm going to break these links momentarily by holding down ALT, the Alt key and left clicking. And I'm going to right click on our return value here and promote our HUD here to a variable and I will call this wb web p underscore HUD like so. And then keep the flow of execution going and pass this along to add that to the viewport. So make sure that you do this in your m v HUD and very important stuff here You must compile in save Why must we Compile and Save because you Now when we jump over to our PC Metroidvania Player Controller blueprint, we're saying we want to get whatever our current HUD is here, we're saying is our current HUD, the M v HUD, and if it is we're going to drag out of our s m v HUD. And we're going to access that w BP underscore, get w BP HUD that we just created over here in our m v HUD.

Blueprint. That guy right there, we're accessing that. Now, why are we accessing that is because I want to say that when we press this button, our black magic menu button, we're going to grab that hood, and I'm going to drag off of here and say Remove from Parent that's essentially a fancy way of saying remove our HUD from the screen. So that will remove like our health bar that's in the upper left, that kind of thing. Okay, so I want to remove that. But I also want to add something well what do I want to add here is my w BP BP magic menu stored in a variable.

So I'm gonna drag that out, we're gonna get that and I'm going to drag off of this and say Add to Viewport organizing it vigorously. Okay, flipping over my page of notes. What also I want to do after I added to the viewport well I want to drag out of my be magic menu here. And I want to look for a be magic menu, intro our animation that we just created in the last video. We're going to grab that. Then we're going to drag off of this and say play animation number of loops to play just one.

What else do I want to do here? Well, I think I would like to play a sound. Let's do a 2d sound in which sound do I want to play, I will have this be flipping over my page of notes, it's going to be start simulate Q. Now if I hover over it, it shows me the pathway for this, this is in my engine content. And if you don't know, if you have engine content enabled or not, you can come under view options. And you can check right there in order to show engine content, then that should be available to you again, you can put in whatever you want.

So I'm gonna put in start simulate queue and you know what, I'm gonna promote this to a variable. So with that sound slotted in, I'm gonna right click on this, I'm going to promote this to a variable and I will call this S FX underscore a menu s effects underscore menu underscore en. So we're gonna play that sound because that's all well and good. Something else I want to do after we do this is I'm going to set game, pause. Make sure you check this boxing. Yep, the game is going to be paused.

Then I'm going to right click, and I'm going to get Player Controller. And I'm going to drag off of this and say, set input mode game and you I hook this in like so. Now we need this node not just the set input mode UI only because if UI only then when we eventually release this button, the reason Least event for this event will not trigger. We have all this yet to hook up. But it's important here that you set your input mode here to be game and UI so that both your game, the game that you're playing in the UI can accept inputs. All right, the the widget to focus on here Well, we could simply say we're going to focus on the W BP black magic menu.

That's the one we want to allow focus. Hook that in, like so. In everything else here is looking okay. Okay, let's move along to what we want to happen. Now when we do our input action black magic menu on the release, we release that button. We're going to make something happen when we hold down the zero button and then or the right shoulder and when we release it, we're going to have something else completely different happen.

Before we do that, let's go ahead and Compile and Save and of course, there is In an error here, let's see what our error is. Aha, we forgot to plug in a play animation target. That's why we compile to find any errors. Well, for this, let's plug in our be magic menu as the target. Let's try to Compile and Save one more time. Everything is good to go.

Alright, next, let's move back to our release event. When we let go of our right shoulder or the zero button and determine what's going to happen, then well the first thing I want to do is here we said we're going to remove our w BP HUD remove that from the screen, our web p od. And when we release our action button here, our black menu magic button I want to add Add to Viewport, we're going to add this back to the viewport so on release, we're going to add our HUD back to the viewport and our w BP magic magic knew which we had previously added when we press the button. Here I'm going to drag off and say Remove from Parent. So we're kind of flip flopping. What we're doing here we're adding one removing the other adding the HUD removing the black magic menu, then sliding on over to the right here a little bit.

Let me just drop this down a little bit lower. And at the end of this video, I'll try to go back through this all so you can see exactly what we have. So after we remove that from the parent, I want to play a sound 2d just like we did here. So I'm going to hit Ctrl C and Ctrl V to copy and paste that I'll drag this execution wire all the way down. The sound that I want to play here is going to be sim you late. It is the end simulate cue that's the one I'm looking for.

And again as I'm hovering over it says it is in the engine folders. Again, if you come under view options right here. That is how you can show your engine content and make that available to you. I will right click on this pin as well. And let's promote this to variable just because we promoted the other one. We'll call this SF x underscore menu underscore off.

Okay, then we want to, I'm gonna Ctrl C, this set game pause Ctrl V it down here, only when we release the button. We want to uncheck this pause to say, Nope, the game is no longer paused. And then lastly, what I want to do is I want to drag off of my Get Player Controller here, drag off that we're going to say set input mode. In this case, we want the input mode to be our game only. No more worries about any UI. So let's kind of walk back through here and see what We've got In fact, before I do that, let me just left click and drag a marquee selection around all this, tap that C key.

And I'll call this my show slash hide. Black Magic menu. Just brings on down here, Let me compile this real quick just to make sure there's no errors. And I'll save and I'll walk us through before we walk through this as a recap. Let's go ahead and play this. So here we are in our level.

Now if I hit the zero key on my keyboard, it shows up. You saw that animation play, let me get rid of that right there. So hit the zero key, it shows up if I release the zero key, it goes away and if I do the right shoulder button, it shows and if I release the right shoulder button, it goes away. Excellent things are working as intended. This is our script notes to an important detail here in our m v HUD. That is located in our project settings, maps and modes and the HUD right there.

The one thing we did inside of here and the HUD is we promoted our w BP HUD to a variable we right clicked right there and promoted that to variable that enabled us over in our PC Metroidvania to drag out of our cast here to access that so that we could remove our HUD from the screen or add it to the screen. So just moving over to the right here showing everything that we've got hooked up, pause the video as you need. And there we have it guys, we have a black magic menu we can bring on or off the screen job well done. That will do it all for this video. We'll see you guys in the next one.

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.