Lens - Script #2

Unreal Engine 4: Character Skill System White Magic - Lens of Truth
11 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

Welcome back everyone in this video, our goal is to create a means of messaging our HUD that our slotted white magic here is no longer ready and that it's actually being used. So we're going to be working in a couple of blueprints here you see me inside of my w BP HUD up here. Also our BP player if you don't remember how to get to these assets, how to get to our w BP HUD is this directory right here, double click on it to open it up. And to get to our BP player, that is this directory, double click on the BP player to open it up. We're going to start off inside of our BP player. And we're going to add something inside of our BP player known as an Event Dispatcher in over in the My Blueprint panel way at the bottom, we've got something called Event dispatchers.

I heard event dispatchers described by Zachary Parrish. And unreal is kinda like Twitter. Basically, what it allows you to do is communicate between blueprints. There is a Tweeter, so to speak. In this case, our BP player is going to be able to send out a tweet. And any listeners, that is subscribers to a Twitter account can pick up on that message and then do something.

So here inside of our BP player, we're going to add an Event Dispatcher by clicking this plus Event Dispatcher. We're gonna call this toggle w magic ready? message. So this is kind of like saying, Hey, we just established a Twitter account. Okay. Next one I want to do is here inside of our white magic tab.

We're where we were creating a This script in the previous video, we're going to come off of where we are updating our manner. And we're going to continue on here a little bit. We're going to add a sequence node by holding down the S key and left clicking. After we update the manner in this whole chain, when we are trying to use our Lens of Truth, which this is still remaining a hookup to initiate that by the way, we're going to update the manner and we got a sequence node here and I'm going to add a couple more pins on this because eventually we're going to be doing multiple things off of the then zero pin. I want to bring in our w magic ready. Let's drag off of this and type in w magic.

Ready. We've got this up Boolean variable, it's in our player info category over here. b w magic ready. So that's another way we can find it. I want to set this We're going to set this to false because it is no longer ready, it is being used at this point. Then after this, I want to bring in our Event Dispatcher here that we just created this toggle w magic ready message.

We're going to drag it into our graph like this. And it's going to give us a little sub menu here. What do we want to do? Well, we want to call this we're going to call this so think of this as our BP player, just establish a Twitter account right here. And now they are sending out a tweet to anyone who is going to be subscribing to their, their Twitter feed here, okay. So after this, we are then going to find that function that we just created our lens FX on, drag that into the graph, and we're going to play our lens FX on function.

Okay, so this video Right here, I'll just left click and drag, tap the C key and call this Lens of Truth on. Okay, so with that done, let's compile in save. And now we are ready to move on to to our w. b p HUD. So again, here in our BP player, we established our Twitter account so to speak, and here we're sending out a tweet. Okay. Now we want our w BP HUD to pee to be able to listen out and receive that message.

So jump on over to our w BP HUD. Let's jump on over to our Graph tab. Currently, I got over to this function, we want to get over to the Event Graph portion of our tab. Okay, so we've got this event construct going on here. We got a few things going off of our event construct reference to the player playing some HUD animations. I want to build off of This sequence note here this then to pin.

So I'm just gonna bring these on down a little bit just for ease of access. And what I want to do is I want to drag in a reference to my player. So under the variable section appears where we created a reference to our players stored in a variable. Under our variable section, we can find our player. So I'm going to drag him into the graph, right here, get the player and out of our player, I'm going to drag out a wire and type in a sign w actually assigned toggle here is our assign toggle w magic ready message. This is the Event Dispatcher that we just created inside of our BP player.

So when I click on this, it's gonna bring in two nodes. It's gonna bring in a bind node and a custom event node, and it gives us this name right off the bat which I'm going to be fine with And what this is going to allow us to do off of event construct. If we wire this in here, what we've just done here is we have said we have basically made it so that our w BP, HUD is now subscribed to this Twitter account. Our player set up that Twitter account that we called toggle w magic ready message. And upon this web hook getting constructed, it's going to listen out for any tweets that come from that Event Dispatcher that is getting called currently right here in our BP player. So when this gets called over in our BP player, our w BP HUD is going to pick up on that and then it will fire out of here to do some script.

So what do we want to have happen? Well, after we drag off here, I'm gonna bring in a flip flop node and a flip flop. Note if you don't know how it works the first time this event gets called it'll go out a then the second time it gets called it'll fire out a B than a than B with every subsequent calling of this message here. And out of the a message, or the a pin, I should say I'm going to drag out a wire and type in set visibility. And I want to set the visibility of our w magic ready? w magic ready?

Where is it w magic. Ready w magic ready? Don't see it. Let me jump back to my Designer tab. My w magic ready text. So there it is W magic ready.

I've got it selected here. And the reason I don't see it over my graph here is because I do not have EAS variable checked here. So let's go ahead and check that. And now that we have is variable checked over in the graph, we can find w Magic ready? Where is it? w Oh, we call the W magic texted me not Yes, W magic txt.

So that's the one we're looking to bring on over. We're gonna get that. We're gonna plug that in as the target. And we're going to say that we want you to become hidden. Like so. Also, I'm going to bring in a reference to our w magic button here.

Get that because we want that to be hidden at this point, as well. However, the second time that we get this message call, we want to do something else. Remember the first time that we receive this tweet. It's going to set the visibility now of our ready text and our ready button, that is this left trigger button right here. It's gonna set them to Hidden, they're gonna go by by the second time this is going to get called, we want to do the opposite, we want to make them visible. So I'm going to duplicate this set visibility function right here, I'm gonna hit Control C, Control V, out of the B plug this in here, set the invisibility now to be visible, and both of these will be plugged into the target.

Now, right now, the only time that this is going to be receiving a tweet is right here in our BP player, we just sent out this message earlier from this portion of script. In a few videos time, we're going to be making another call to toggle the W magic ready message to essentially fire this out again so that we then fire out of the B output. So for now, we've only got it set up to call this one time and to set this hidden But eventually, we will set this back to be visible, you're just gonna have to be patient and wait for a few more videos. Okay, so after our set visibility down here, I want to do one more thing I'm going to drag off and say plays sound, 2d. This is just a little sound effect to accompany this. And the sound effect that I want to put in here is going to be click on button Q, this is an engine content sounds.

So again, if you don't have that available to you, make sure you are showing engine content and you will have it as well. Okay, so with that, let me just kind of bring these nodes down a little bit. going to left click drag out, tap the C key, put a comment box around all this that says sets. white magic ready? message and button on the HUD sure I'll set this to be green as well just to be consistent with what I've done before here. Okay, and finally, let's go ahead and compile, see if we made any mistakes here and save.

And that's going to do it all for part number two of our lens scripting still plenty more to be done. But that will come see you in the next video.

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.