Lens - Script #6

Unreal Engine 4: Character Skill System White Magic - Lens of Truth
14 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.20
List Price:  €130.49
You save:  €37.28
£79.91
List Price:  £111.88
You save:  £31.96
CA$136.56
List Price:  CA$191.19
You save:  CA$54.63
A$153.05
List Price:  A$214.27
You save:  A$61.22
S$136.08
List Price:  S$190.51
You save:  S$54.43
HK$782.75
List Price:  HK$1,095.88
You save:  HK$313.13
CHF 91.21
List Price:  CHF 127.70
You save:  CHF 36.49
NOK kr1,100.23
List Price:  NOK kr1,540.37
You save:  NOK kr440.13
DKK kr695.05
List Price:  DKK kr973.10
You save:  DKK kr278.04
NZ$168.07
List Price:  NZ$235.31
You save:  NZ$67.23
د.إ367.25
List Price:  د.إ514.16
You save:  د.إ146.91
৳10,970.75
List Price:  ৳15,359.49
You save:  ৳4,388.74
₹8,335.10
List Price:  ₹11,669.48
You save:  ₹3,334.37
RM476.90
List Price:  RM667.68
You save:  RM190.78
₦130,608.93
List Price:  ₦182,857.73
You save:  ₦52,248.80
₨27,840.21
List Price:  ₨38,977.41
You save:  ₨11,137.19
฿3,694.31
List Price:  ฿5,172.18
You save:  ฿1,477.87
₺3,253.72
List Price:  ₺4,555.34
You save:  ₺1,301.61
B$515.88
List Price:  B$722.26
You save:  B$206.37
R1,886.05
List Price:  R2,640.54
You save:  R754.49
Лв182.13
List Price:  Лв254.99
You save:  Лв72.85
₩137,567.94
List Price:  ₩192,600.62
You save:  ₩55,032.68
₪380.78
List Price:  ₪533.11
You save:  ₪152.32
₱5,769.12
List Price:  ₱8,077
You save:  ₱2,307.87
¥15,680.08
List Price:  ¥21,952.74
You save:  ¥6,272.66
MX$1,724.22
List Price:  MX$2,413.98
You save:  MX$689.75
QR364.68
List Price:  QR510.56
You save:  QR145.88
P1,379.77
List Price:  P1,931.74
You save:  P551.96
KSh13,498.65
List Price:  KSh18,898.65
You save:  KSh5,400
E£4,789.68
List Price:  E£6,705.74
You save:  E£1,916.06
ብር5,693.24
List Price:  ብር7,970.76
You save:  ብር2,277.52
Kz83,560.30
List Price:  Kz116,987.77
You save:  Kz33,427.46
CLP$94,840.51
List Price:  CLP$132,780.51
You save:  CLP$37,940
CN¥724.59
List Price:  CN¥1,014.46
You save:  CN¥289.86
RD$5,873.12
List Price:  RD$8,222.61
You save:  RD$2,349.48
DA13,427.17
List Price:  DA18,798.58
You save:  DA5,371.40
FJ$225.97
List Price:  FJ$316.37
You save:  FJ$90.39
Q777.73
List Price:  Q1,088.86
You save:  Q311.12
GY$20,914.34
List Price:  GY$29,280.91
You save:  GY$8,366.57
ISK kr13,988.60
List Price:  ISK kr19,584.60
You save:  ISK kr5,596
DH1,011.63
List Price:  DH1,416.33
You save:  DH404.69
L1,776.81
List Price:  L2,487.61
You save:  L710.79
ден5,738.79
List Price:  ден8,034.54
You save:  ден2,295.74
MOP$805.67
List Price:  MOP$1,127.97
You save:  MOP$322.30
N$1,914.68
List Price:  N$2,680.63
You save:  N$765.95
C$3,678.96
List Price:  C$5,150.69
You save:  C$1,471.73
रु13,310.19
List Price:  रु18,634.81
You save:  रु5,324.61
S/372.97
List Price:  S/522.18
You save:  S/149.20
K385.04
List Price:  K539.08
You save:  K154.03
SAR375.02
List Price:  SAR525.04
You save:  SAR150.02
ZK2,631.59
List Price:  ZK3,684.33
You save:  ZK1,052.74
L463.78
List Price:  L649.31
You save:  L185.53
Kč2,343.96
List Price:  Kč3,281.64
You save:  Kč937.68
Ft36,581.40
List Price:  Ft51,215.43
You save:  Ft14,634.02
SEK kr1,089.92
List Price:  SEK kr1,525.94
You save:  SEK kr436.01
ARS$87,365.86
List Price:  ARS$122,315.70
You save:  ARS$34,949.84
Bs692.26
List Price:  Bs969.20
You save:  Bs276.93
COP$394,057.74
List Price:  COP$551,696.60
You save:  COP$157,638.86
₡50,249.28
List Price:  ₡70,351
You save:  ₡20,101.72
L2,468.18
List Price:  L3,455.56
You save:  L987.37
₲742,598.03
List Price:  ₲1,039,666.95
You save:  ₲297,068.91
$U3,834.62
List Price:  $U5,368.62
You save:  $U1,534
zł402.81
List Price:  zł563.95
You save:  zł161.14
Already have an account? Log In

Transcript

Welcome once again everyone. The goal in this video is to make it so that we can actually test out our Lens of Truth skill. Now, additionally, we're going to hook up our white magic ready animation in the HUD to ensure that we alert the player that they can use their white magic skill. Once that cooldown timer has expired, let's not waste any time let's jump right to it by getting into our settings, Project Settings. And the first thing we need to do is add a new input action mapping. Let's click the plus button here to add a new action mapping.

We're going to call this white magic. And we want to use a white magic ability when we press either the right shift key or click this plus button to add another input that it can accept will do the left trigger button. On a gamepad as well. Okay, so with this action mapping created, we can exit out of our project settings. And next I want to do some work inside of our BP player. If you don't remember where that is, here is the directory how to find your BP player, double click on it to open it up.

And here I am in my white magic tab, which is located right here in the graphs portion of the My Blueprint panel. Currently, I have some scripting here for our Lens of Truth skill. I'm going to be working off to the left hand side here a little bit. So let me just mouse wheel in, and then right click and we can do a search for white magic. There is that action event that we just created in our project settings. So I want something that obviously happened when we press the right shift key or our left trigger button, but I need to evaluate something first.

First, what I need to find out is what is our currently slotted white metal skill. And here in our my blueprints panel under the variable section we've got our white magic slotted let's drag and drop this in. Let's get that. Currently I have mine set to none which is fine. We could hard set it here but I will leave it at none. Let's drag off of this and type in switch switch on IE white magic.

So here is a switch node let's hook in this execution wire right away off the press event. And depending on what we have slotted into our white magic slotted variable here, we will fire off of one of these outputs. So if white magic slotted is our missed, we will fire out of here when we press the right shift or left trigger button. Or if our white magic slotted is our Lens of Truth whenever we press right shift or left trigger will fire out of here. Here. Now, I currently have this set to none.

So how does this variable get set to one of these other values? Well, if you recall right back in our w BP white magic menu, and you don't have to open this up, I'm just here to show you. Again, you know, this is this is what our white magic menu looks like here right? over on my Graph tab we are doing in the this is the Event Graph here. We're doing this select magic macro, etc. And when we are trying to select one of these and I'll just kind of fall down our Lens of Truth here.

There's this macro that you can double click on to see what that all does. But long story short, when we're trying to select our Lens of Truth and set that at the very end here we're saying in our player that w magic slotted should be set to the Lens of Truth. So here in our w magic menu This is where we're setting this particular variable in our BP player. And that is in turn going to determine which white magic skill we use when we press this button, the right shift or the left trigger. Alright, so we've only been working on our Lens of Truth the scale for now. So after this I'm gonna drag off and type in US Lens of Truth we're gonna call for this to happen.

So what did we just do here So note that this says use Lens of Truth. And if I scroll on out here a little bit, here is my use Lens of Truth Custom Event. So this is what is finally going to kick start the using of the Lens of Truth and do all of this script right over here that we've been creating the last few videos. Okay, so think of this is like a wireless connection here. I could have just as easily this would do the same thing, by the way, plugging this into this branch and getting rid of this This would be fine. This is doing the exact same thing.

Let me just try to make this a little bit more clear right here. This is doing the exact same thing as this is by doing a wireless connection. We're simply calling for this custom events to happen. Just keep things a little bit cleaner. Let's actually put a comment box around all this left click and drag chapter C key. And let's call this use white magic.

And I'll Compile and Save your quickly. Now for the next part of this, I want to hook up our w magic ready HUD animation in our w BP HUD asset. So why don't you jump on over there by coming under this directory. Double clicking on your W BP HUD. There we are. Let's jump on over to the Graph tab here.

And currently I have one of my function tabs open. Let's go over to the Event Graph. And if you don't see your Event Graph, you can click it right over here in the My Blueprint panel. And we've got this bit of script put together. Most recently, we put together this sets white magic ready message. And we're going to be working off this lower portion of the script right here.

All we need to do is extend out this script a little bit further, I want to grab my animation here in the variables panel, we should have a white magic ready animation that is right there. And again, if you don't see this, make sure you click this little arrow here to reveal all your animations. Over here in the Designer tab. Let's drag this on out, plop it into the graph. We're gonna get that and then drag off of this and say play animation. let's hook this in like so.

Number of loops to play one I will drag out a comment box, tap the C key and we'll call this our white magic ready. Good animation. Oh, why not? Why don't I color this green just to stay consistent. There we go. And now we are ready to test this out after we Compile and Save.

So I wanted to create a little bit of a test scenario here. And I did some prep work prior to starting up this video just so would cut down on time, I'll just let you know what I've done. So I have placed some bricks out here. These are my BP secret wall bricks. I got them from the actors folder here. I placed a few of these in my level.

A few things to note here is I size these all up so I placed them in the level and I've got nine of them here total if I select them, and I scale them up like so two times the size In the x three times the size and the y and two times the size in the Z. And then I also placed some BP secret platforms out in the level. Right now I've got three of them one, two, and three. And the reason they all look like this is because if you remember right, I am hiding that platform mesh for the time being. Okay, so now to also test this out, I want to jump in and play and actually collected my various skills here. So I'm going to go over and collect my Lens of Truth and my missed and then I will set it to Lens of Truth and we'll take it from there.

Here we go. All right, so I'm just gonna run on over and collect my Lens of Truth. Got that Okay. Got that. That's and now you can see I don't have any white magic slotted yet. So I'm going to set some white magic here.

So I'm going to hold over to the Lens of Truth and select that. So now if I press my right shift key, I'm using the w, s and D to control right now in the right shift key I'm going to use to try to activate this. Let's see what happens. So you can see I can go through all of these right now. And also I've revealed my various platforms here which I can't jump upon because I kind of boxed myself in here. I do notice a problem right now and that my Lens of Truth meter is not decreasing.

So obviously a problem there to check out. Let me just deactivate my Lens of Truth here by hitting the right shift key. Okay, now we can see that that cooldown meter in the upper right decreasing. Okay, and then that ready text did appear back again. So let me use it one more time. Okay, oh there is my meter it is decreasing.

Maybe I just wasn't paying attention to it before. So now it finishes depleting it should be shutting off automatically once that meter depletes. So let me just shut it off look in the upper right you're seeing that cooldown meter over the Lens of Truth. Okay, let me try this again. The camera effect takes place let me auto turn it off. Okay, so the auto turn off works but when our meter is depleting the whole way it is not shutting off.

So let's look into that issue quickly. Jumping on into our BP player let's check out our lead script. So here was our our lens active timer and so when this is finished, okay, this is what happens when you name things to similarly this should not be lens timer stop that we are calling. I should be calling lens timer. Up, this is what I should be calling the custom event because when this is finished, this is going to make a call over to this Custom Event right up over here. And this custom event is going to tell our lens to deactivate call this lens timer stop custom event which is going to then tell this to stop and everything should be good to go.

So note that change, human error, my bad, this should be lens timer up off of the finish output of our lens active timer. Let's Compile and Save and try this once again. So I'm gonna navigate on over to collect, I really only need the Lens of Truth skill for right now. So there we go, we got it. And actually, let me kind of reside over on this side of the platform because I want to be able to jump onto that as well. So I'm gonna set lenses Truth be my white magic skill.

Okay, let me hit the shift key now to activate it. I'm gonna let it decrease all the way. Let's see if that auto dx d activates it now. And it does you can see the cooldown timer in the upper right. Okay, let me try to jump on the platforms this time, jump, jump, jump, let's see if this removes collision like it should. I'm trying to use that white magic skill but I can't during the cooldown phase.

And this looks to be working as intended. Now, note my my mess here. My platform here is a little weird in that that platform on the underside kind of looked a little invisible but you know what, I'm not gonna stress about that for the time being. The point is we have this ability working as we want to now know This is supposed to be walkthrough. I did not do anything with the collision by having it collide when you don't have the Lens of Truth ability on. And the reason I did that is because I did not want to have to deal with the issue of what happens if you turn this ability on Whoops, I just kind of did a double take there.

If I turn this ability on and then it ends while I'm inside of it, I'd have to deal with that issue. So I chose just to make it so the Lens of Truth kind of acts as a revealer to show where there are walls that you can walk through. Anyways guys, everything now appears to be working as intended. I'm gonna finish this up by putting one big common box around our Lens of Truth skill here, tap that C key and I'm just gonna call this Lens of Truth and you can't see that because we are way too far away. There it is. One more Compile and Save.

Great job guys. That'll do it all for this one. See you in the next one. Aha

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.