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
€93.70
List Price:  €131.19
You save:  €37.48
£80.17
List Price:  £112.24
You save:  £32.07
CA$137.56
List Price:  CA$192.60
You save:  CA$55.03
A$155.17
List Price:  A$217.25
You save:  A$62.07
S$135.98
List Price:  S$190.37
You save:  S$54.39
HK$783.01
List Price:  HK$1,096.25
You save:  HK$313.23
CHF 90.89
List Price:  CHF 127.26
You save:  CHF 36.36
NOK kr1,101.16
List Price:  NOK kr1,541.68
You save:  NOK kr440.51
DKK kr699.21
List Price:  DKK kr978.92
You save:  DKK kr279.71
NZ$168.70
List Price:  NZ$236.19
You save:  NZ$67.48
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳10,942.52
List Price:  ৳15,319.96
You save:  ৳4,377.44
₹8,353.31
List Price:  ₹11,694.97
You save:  ₹3,341.66
RM478.30
List Price:  RM669.64
You save:  RM191.34
₦129,687.03
List Price:  ₦181,567.03
You save:  ₦51,880
₨27,754.24
List Price:  ₨38,857.05
You save:  ₨11,102.81
฿3,676.55
List Price:  ฿5,147.32
You save:  ฿1,470.77
₺3,250.48
List Price:  ₺4,550.80
You save:  ₺1,300.32
B$523.28
List Price:  B$732.62
You save:  B$209.33
R1,903.66
List Price:  R2,665.20
You save:  R761.54
Лв183.15
List Price:  Лв256.41
You save:  Лв73.26
₩137,464.20
List Price:  ₩192,455.38
You save:  ₩54,991.18
₪378.95
List Price:  ₪530.55
You save:  ₪151.59
₱5,720.89
List Price:  ₱8,009.48
You save:  ₱2,288.58
¥15,440.72
List Price:  ¥21,617.62
You save:  ¥6,176.90
MX$1,696.11
List Price:  MX$2,374.63
You save:  MX$678.51
QR363.78
List Price:  QR509.31
You save:  QR145.52
P1,378.02
List Price:  P1,929.29
You save:  P551.26
KSh13,298.67
List Price:  KSh18,618.67
You save:  KSh5,320
E£4,850.08
List Price:  E£6,790.31
You save:  E£1,940.22
ብር5,673.01
List Price:  ብር7,942.45
You save:  ብር2,269.43
Kz83,741.62
List Price:  Kz117,241.62
You save:  Kz33,500
CLP$97,883.21
List Price:  CLP$137,040.41
You save:  CLP$39,157.20
CN¥723.83
List Price:  CN¥1,013.40
You save:  CN¥289.56
RD$5,893.56
List Price:  RD$8,251.22
You save:  RD$2,357.66
DA13,447.21
List Price:  DA18,826.63
You save:  DA5,379.42
FJ$227.04
List Price:  FJ$317.87
You save:  FJ$90.82
Q775.43
List Price:  Q1,085.64
You save:  Q310.20
GY$20,874.74
List Price:  GY$29,225.48
You save:  GY$8,350.73
ISK kr14,084.59
List Price:  ISK kr19,718.99
You save:  ISK kr5,634.40
DH1,011.98
List Price:  DH1,416.82
You save:  DH404.83
L1,789.85
List Price:  L2,505.87
You save:  L716.01
ден5,767.34
List Price:  ден8,074.51
You save:  ден2,307.16
MOP$804.17
List Price:  MOP$1,125.87
You save:  MOP$321.70
N$1,897.84
List Price:  N$2,657.05
You save:  N$759.21
C$3,669.73
List Price:  C$5,137.77
You save:  C$1,468.04
रु13,346.58
List Price:  रु18,685.75
You save:  रु5,339.16
S/375.13
List Price:  S/525.19
You save:  S/150.06
K378.96
List Price:  K530.57
You save:  K151.60
SAR375.09
List Price:  SAR525.14
You save:  SAR150.05
ZK2,519.95
List Price:  ZK3,528.03
You save:  ZK1,008.08
L466.17
List Price:  L652.66
You save:  L186.48
Kč2,369.01
List Price:  Kč3,316.71
You save:  Kč947.70
Ft36,915.02
List Price:  Ft51,682.51
You save:  Ft14,767.48
SEK kr1,089.22
List Price:  SEK kr1,524.96
You save:  SEK kr435.73
ARS$86,913.85
List Price:  ARS$121,682.87
You save:  ARS$34,769.02
Bs690.45
List Price:  Bs966.66
You save:  Bs276.20
COP$391,130.80
List Price:  COP$547,598.77
You save:  COP$156,467.96
₡49,957.95
List Price:  ₡69,943.14
You save:  ₡19,985.18
L2,461.44
List Price:  L3,446.12
You save:  L984.67
₲737,867.79
List Price:  ₲1,033,044.43
You save:  ₲295,176.63
$U3,889.78
List Price:  $U5,445.86
You save:  $U1,556.07
zł405.87
List Price:  zł568.23
You save:  zł162.36
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.