Lens - Player Functions

Unreal Engine 4: Character Skill System White Magic - Lens of Truth
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
€96.03
List Price:  €134.44
You save:  €38.41
£78.97
List Price:  £110.57
You save:  £31.59
CA$143.92
List Price:  CA$201.50
You save:  CA$57.57
A$160.15
List Price:  A$224.22
You save:  A$64.06
S$135.90
List Price:  S$190.26
You save:  S$54.36
HK$776.95
List Price:  HK$1,087.76
You save:  HK$310.81
CHF 89.61
List Price:  CHF 125.46
You save:  CHF 35.85
NOK kr1,132.24
List Price:  NOK kr1,585.18
You save:  NOK kr452.94
DKK kr716.48
List Price:  DKK kr1,003.10
You save:  DKK kr286.62
NZ$176.72
List Price:  NZ$247.41
You save:  NZ$70.69
د.إ367.25
List Price:  د.إ514.17
You save:  د.إ146.91
৳11,949.45
List Price:  ৳16,729.71
You save:  ৳4,780.25
₹8,504.71
List Price:  ₹11,906.93
You save:  ₹3,402.22
RM450.50
List Price:  RM630.72
You save:  RM180.22
₦155,597.43
List Price:  ₦217,842.63
You save:  ₦62,245.20
₨27,817.89
List Price:  ₨38,946.16
You save:  ₨11,128.27
฿3,454.30
List Price:  ฿4,836.16
You save:  ฿1,381.86
₺3,507.24
List Price:  ₺4,910.28
You save:  ₺1,403.03
B$630.94
List Price:  B$883.35
You save:  B$252.40
R1,822.81
List Price:  R2,552.01
You save:  R729.20
Лв187.70
List Price:  Лв262.78
You save:  Лв75.08
₩144,917.66
List Price:  ₩202,890.52
You save:  ₩57,972.86
₪361.94
List Price:  ₪506.74
You save:  ₪144.79
₱5,900.06
List Price:  ₱8,260.32
You save:  ₱2,360.26
¥15,702.92
List Price:  ¥21,984.72
You save:  ¥6,281.80
MX$2,038.30
List Price:  MX$2,853.70
You save:  MX$815.40
QR368.69
List Price:  QR516.19
You save:  QR147.49
P1,365.11
List Price:  P1,911.21
You save:  P546.09
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£5,089.47
List Price:  E£7,125.47
You save:  E£2,035.99
ብር12,635.69
List Price:  ብር17,690.47
You save:  ብር5,054.78
Kz91,513.08
List Price:  Kz128,121.98
You save:  Kz36,608.89
CLP$99,000
List Price:  CLP$138,603.96
You save:  CLP$39,603.96
CN¥729.57
List Price:  CN¥1,021.43
You save:  CN¥291.86
RD$6,083.32
List Price:  RD$8,516.89
You save:  RD$2,433.57
DA13,417.46
List Price:  DA18,784.98
You save:  DA5,367.52
FJ$231.78
List Price:  FJ$324.51
You save:  FJ$92.72
Q770.27
List Price:  Q1,078.41
You save:  Q308.14
GY$20,904.88
List Price:  GY$29,267.67
You save:  GY$8,362.78
ISK kr13,874.61
List Price:  ISK kr19,425.01
You save:  ISK kr5,550.40
DH998.53
List Price:  DH1,397.99
You save:  DH399.45
L1,842.29
List Price:  L2,579.28
You save:  L736.99
ден5,908.76
List Price:  ден8,272.50
You save:  ден2,363.74
MOP$800.37
List Price:  MOP$1,120.56
You save:  MOP$320.18
N$1,804.90
List Price:  N$2,526.94
You save:  N$722.03
C$3,679.90
List Price:  C$5,152.01
You save:  C$1,472.10
रु13,596.02
List Price:  रु19,034.98
You save:  रु5,438.95
S/373.62
List Price:  S/523.08
You save:  S/149.46
K405.04
List Price:  K567.08
You save:  K162.03
SAR375.67
List Price:  SAR525.96
You save:  SAR150.28
ZK2,767.31
List Price:  ZK3,874.34
You save:  ZK1,107.03
L477.70
List Price:  L668.80
You save:  L191.10
Kč2,412.77
List Price:  Kč3,377.98
You save:  Kč965.20
Ft39,808.32
List Price:  Ft55,733.24
You save:  Ft15,924.92
SEK kr1,103.71
List Price:  SEK kr1,545.23
You save:  SEK kr441.52
ARS$102,213.30
List Price:  ARS$143,102.71
You save:  ARS$40,889.41
Bs690.92
List Price:  Bs967.31
You save:  Bs276.39
COP$438,077.06
List Price:  COP$613,325.41
You save:  COP$175,248.35
₡50,326.04
List Price:  ₡70,458.47
You save:  ₡20,132.42
L2,538.30
List Price:  L3,553.73
You save:  L1,015.42
₲780,569.17
List Price:  ₲1,092,828.06
You save:  ₲312,258.89
$U4,458.42
List Price:  $U6,241.97
You save:  $U1,783.54
zł409.45
List Price:  zł573.24
You save:  zł163.79
Already have an account? Log In

Transcript

All right, welcome back everyone in this video Our goal is to create a lens on and a lens off function inside of our BP player. Now you may have noticed when we activated our white magic Lens of Truth skill in some of the previous videos there, what are some of the things that we saw change? Well, when we turned it on, we saw the meter appear. We saw the materials for our secret wall and our secret platform change. We we even made our secret platform show and hide and even made it so that the collision toggled on and off. So we're going to be creating a couple of functions here to turn on and off those various effects.

So with that all out of the way come under your content Metroidvania blueprints characters folder, double click on your BP player because this is where we're going to be creating our functions inside of our People are over in the My Blueprint panel, find your function section function section and let's create a new function. And I will call this lens FX underscore on. Okay, a lot of things we're going to do when we call this function, the first thing I want to do is down in our variable section come under your white magic Lens of Truth, we want to grab our B is using lens Boolean variable that we created many moons ago. We're going to drag it into our graph, drop it, we're going to set this and here we are going to say that yes, we are using the Lens of Truth. Then we're going to drag off of this and we're going to play a sound.

Play a sound 2d and the one that I want to play here is is clicking this drop down. It's called eg from player Q. And I'm going to click this little drop down arrow here to bring on some of my advanced options because I want to up the volume multiplier here to be three. K, then after this, I want to grab my W, my widget w magic timer. Let's drag and drop this component into our graph. And then we want to drag off of this and we want to set the visibility of our timer widget.

Remember, we are hiding it right now. And here we want to set the visibility to be on so very important that you check that box right there that's going to indicate that you should be turning it on. All right, next, we're going to take our es FX white magic lens active sound. I'm going to drag and drop this component in here. Drag off of it. And we're going to say activate.

Remember, this sound effect, this sound component, I should say, was D activated coming under our Details panel. It is not set to be auto activated. So in this function is where we're going to say, hey, play that sound. Okay, scooching on over to the right a little bit, let me just maximize my screen real estate a little bit. After this, we're going to bring in a sequence node. quick way to do that hold down the S key and left click there is a sequence node.

And I'm doing this more for cleanliness sake here I'm gonna have something branch off of here as well as here. Let's work off of the then zero branch first. First thing I'm going to do is drag off in type in, get all actors of class right here under the utility section, get all actors of class. Get all actors of what class Well, I want to grab all actors have my wall, my BP secret wall. And this is going to spit out an array of actors so that if we have multiples of them placed into the level, it'll get them all. And out of my out actors I'm going to drag out and type in for each.

We're going to bring in a for each loop. So for each of our secret walls, we want to do something. Well what do we want to do for each one of these? We're going to grab out of our array element, meaning for each one of these, we're going to get our mesh, get the mesh and then we are going to drag off of this and we are going to set the material. So the loop body plugs into the material here. And what do we want to set our material here?

Well, we created our m underscore lens of the Lens of Truth wall m Lens of Truth wall. So this is what is going to change the material of the wall that have that kind of purple see through look. Okay, so that's pretty good. Next let's work off of the then one branch. We're gonna drag off of here we're gonna get all actors of class right here in the utility section, get all actors of class. Here we want to find our platform, our BP secret platform.

So up here was the wall down here we're dealing with our platform. Let's drag off of it and bring in a for each loop. Make sure you plug in that execution layer. For each of these, we are going to drag off the array element and get mesh. There it is or get mesh. And we're going to drag off of this a few times because there's much that we want to alter about this when we turn on our Lens of Truth.

First thing we're going to do is drag off of this and type in set visibility. For our platform, it's going to be hidden by default. So we're going to turn our visibility on. And just to double check here, let me go back to my actors, secret platform viewports currently, my mesh here. coming under here, currently, I do have it set to visible by default. So I should check this to I should say rather uncheck it so that we are not seeing that by default.

So go to your secret platform, select your mesh in the Details panel, let's uncheck the visible the visible checkbox here to make sure that it is hidden by default. Okay. Let me jump back to my BP player. Because here in our lens on function, we're saying hey, all secret platforms, we're going to get your mesh and now we're going to make it visible. Okay, that's not the only thing we're going to do off of our mesh here. Let's drag off of our mesh again, and we're going to set a material.

I'm going to hook in my execution wires like so. Our material for this one is going to be our Lens of Truth. And I spelled truth wrong Lens of Truth platform that yellowish one. Then I'm going to drag off of my mesh again, and I want to set collision enable, there's a function for it. Set collision enabled, make sure the execution wire is flowing into that as well. Let's bring our mesh on down a little bit.

And here I'm gonna set the collision type to be collision enabled query and physics. So that'll make it so that we can actually land on our platform. Remember here in our BP secret platform with our mesh selected by come under the collision section currently, by default, the collision is set to have no collision. Here in our BP player in our lens on function, this is where we're actually enabling it. Okay, and then let's drag off of our mesh one more time and type in set collision. And I'm looking for response to Chanel that's channel and I will hook in our execution wires.

Like so. And I am going to change the channel to be world dynamic. And the new response here is going to be blocked. What is this gonna do? Well, right up evolve, we're saying hey enable collision down below here we're saying we want our response here to now be blocked so that it is going to make it so that it can block things our character doesn't just pass right through it. Alright, so that is going to be our lens on effects.

With that done. Let's compile here to see if we made any mistakes. doesn't look that way. And then save. And now we're ready to move on to the lens off effects. So let's create a new function for that.

Come under my blueprints function, click the plus button to add a new function, lens FX underscore off and we're going to start This off by setting RB is using lens Let me hold down the Alt key and left click, drag one of these in and when you hold down the Alt key and left click, that brings in a setter right away. We're gonna set this to false. So when our lens effects is off, we want to say hey, we are no longer using the lens. Let's drag off of this type in play sound 2d. And the sound that we want to slot in here is going to be deject. Mm hmm.

Excuse me, eject from player Q. There we go. Then we are going to bring in our widget. Again, our w magic timer widget. We're going to grab off of this say set visibility and when we are turning off this effect, we want the visibility Have you to be checked off so make sure that that is unchecked. Then we are going to get our es FX white magic lens active component, we're going to grab that Drag off of that.

And here we're going to type in fade out, there's an audio function for fading out. So that's gonna fade out that sound effect that is playing. Let's set the fade out duration to be one second show. And the fade volume level zero is what we want. Then let's bring in the sequence node. S key left click to quickly grab a sequence node.

And just like we did before, we're going to build a little little bit off the then zero branch and then off of the event one branch. These then zero branch is going to deal with our secret wall. So let's right click. Let's get all actors of class get all actors of class. Click this drop down we are referring to our secret wall secret wall up here. Let's drag out of the out actors that's going to get all secret walls for each, we want the for each loop, make sure you hook in the execution wire.

And then for each of these, we're going to drag out of our array elements, we're gonna get our mesh once again, I suppose it could have copied and pasted a lot of this from our lens on function that we created. But that's okay, we get to redo this again, see how this is all flowing together and let's set the material. Practice makes perfect. And the material we want to change this back to is the original which is our brick, underscore, clay. underscore old. All right, so that's looking good.

Let's now work under the then one output pin. Let's get all actors of class, get actors, act tours of class. There it is get all actors of class. Here we're going to be dealing with our platform, get all secret platforms, drag out of the out actors and bring in another for each loop. Let's drag off the array element and get our mesh. And much like we did before, we're going to drag off of our mesh, we're going to set the visibility and whereas before we were toggling it on here, we want this unchecked, we want it to not be visible.

Let's drag off of our mesh one more time. Let's set material Let's set our material back to our brick clay. Well actually, we don't even need to set a material for this because we are setting it hidden. So this is, this is technically not something you need to do. If it's visible, you don't even need to see the original material on it, so it doesn't really matter. In fact, I think I'll even skip that step right there.

But let's drag off of our mesh and let's do set collision enabled. And here we are going to leave it as no collision, we do not want to collide with it if we can't see it. Let's Compile and Save. And I'll try to frame this all up so you can see exactly what we have for our lens off function right here. Here's the first part of the lens off function. That's eject from player that is in the engine sounds By the way, of course slot in whatever Do you want sliding over to the right here is the right most part of our lens f x off.

And then our lens FX on. looks kind of like this. That's the first part. And then the second part, make sure you got all the appropriate boxes checked in terms of like the visibility and whatnot. I'll scroll down this one's a little bit tough to see. And right there.

Okay, I'm gonna save this one more time. Now, we can't actually check this out yet because we're not actually calling these functions yet that we will get going soon enough. But that'll do it all for this video guys. We will see you 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.