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
€95.85
List Price:  €134.19
You save:  €38.34
£79.54
List Price:  £111.35
You save:  £31.81
CA$143.73
List Price:  CA$201.23
You save:  CA$57.50
A$159.93
List Price:  A$223.91
You save:  A$63.97
S$135.54
List Price:  S$189.77
You save:  S$54.22
HK$777.83
List Price:  HK$1,089
You save:  HK$311.16
CHF 89.34
List Price:  CHF 125.09
You save:  CHF 35.74
NOK kr1,131.88
List Price:  NOK kr1,584.68
You save:  NOK kr452.80
DKK kr715.08
List Price:  DKK kr1,001.15
You save:  DKK kr286.06
NZ$176.75
List Price:  NZ$247.46
You save:  NZ$70.70
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.92
৳11,945.33
List Price:  ৳16,723.94
You save:  ৳4,778.61
₹8,493.77
List Price:  ₹11,891.62
You save:  ₹3,397.85
RM450.75
List Price:  RM631.07
You save:  RM180.32
₦154,938.50
List Price:  ₦216,920.10
You save:  ₦61,981.60
₨27,824.38
List Price:  ₨38,955.25
You save:  ₨11,130.86
฿3,419.79
List Price:  ฿4,787.84
You save:  ฿1,368.05
₺3,519.01
List Price:  ₺4,926.76
You save:  ₺1,407.74
B$608.53
List Price:  B$851.97
You save:  B$243.44
R1,830.80
List Price:  R2,563.19
You save:  R732.39
Лв187.32
List Price:  Лв262.25
You save:  Лв74.93
₩144,627.53
List Price:  ₩202,484.33
You save:  ₩57,856.80
₪365.39
List Price:  ₪511.57
You save:  ₪146.17
₱5,882.91
List Price:  ₱8,236.31
You save:  ₱2,353.40
¥15,643.93
List Price:  ¥21,902.13
You save:  ¥6,258.20
MX$2,007.58
List Price:  MX$2,810.70
You save:  MX$803.11
QR364.41
List Price:  QR510.19
You save:  QR145.78
P1,381.63
List Price:  P1,934.33
You save:  P552.70
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£5,087.81
List Price:  E£7,123.14
You save:  E£2,035.32
ብር12,764.56
List Price:  ብር17,870.89
You save:  ብር5,106.33
Kz91,790.82
List Price:  Kz128,510.82
You save:  Kz36,720
CLP$98,905.10
List Price:  CLP$138,471.10
You save:  CLP$39,566
CN¥729.56
List Price:  CN¥1,021.42
You save:  CN¥291.85
RD$6,087.13
List Price:  RD$8,522.23
You save:  RD$2,435.09
DA13,485.25
List Price:  DA18,879.89
You save:  DA5,394.64
FJ$231.62
List Price:  FJ$324.28
You save:  FJ$92.66
Q770.23
List Price:  Q1,078.35
You save:  Q308.12
GY$20,913.67
List Price:  GY$29,279.97
You save:  GY$8,366.30
ISK kr13,911.60
List Price:  ISK kr19,476.80
You save:  ISK kr5,565.20
DH1,006.07
List Price:  DH1,408.53
You save:  DH402.46
L1,836.70
List Price:  L2,571.46
You save:  L734.75
ден5,900.06
List Price:  ден8,260.33
You save:  ден2,360.26
MOP$800.26
List Price:  MOP$1,120.39
You save:  MOP$320.13
N$1,840.36
List Price:  N$2,576.58
You save:  N$736.22
C$3,678.42
List Price:  C$5,149.94
You save:  C$1,471.51
रु13,597.49
List Price:  रु19,037.04
You save:  रु5,439.54
S/372.23
List Price:  S/521.13
You save:  S/148.90
K405.36
List Price:  K567.52
You save:  K162.16
SAR375.62
List Price:  SAR525.88
You save:  SAR150.26
ZK2,766.46
List Price:  ZK3,873.15
You save:  ZK1,106.69
L477.10
List Price:  L667.96
You save:  L190.86
Kč2,408.98
List Price:  Kč3,372.68
You save:  Kč963.69
Ft39,689.03
List Price:  Ft55,566.23
You save:  Ft15,877.20
SEK kr1,103.13
List Price:  SEK kr1,544.43
You save:  SEK kr441.30
ARS$102,160.40
List Price:  ARS$143,028.65
You save:  ARS$40,868.24
Bs690.76
List Price:  Bs967.10
You save:  Bs276.33
COP$435,928.80
List Price:  COP$610,317.76
You save:  COP$174,388.96
₡50,434.81
List Price:  ₡70,610.75
You save:  ₡20,175.94
L2,537.51
List Price:  L3,552.62
You save:  L1,015.10
₲779,455.88
List Price:  ₲1,091,269.42
You save:  ₲311,813.53
$U4,474.38
List Price:  $U6,264.31
You save:  $U1,789.93
zł408.66
List Price:  zł572.14
You save:  zł163.48
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.