Electro Spark - Use Script #1

Unreal Engine 4: Character Skill System Black Magic - Electro Spark
17 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.21
List Price:  €134.70
You save:  €38.49
£79.93
List Price:  £111.90
You save:  £31.97
CA$143.79
List Price:  CA$201.32
You save:  CA$57.52
A$160.48
List Price:  A$224.69
You save:  A$64.20
S$135.83
List Price:  S$190.17
You save:  S$54.33
HK$777.07
List Price:  HK$1,087.93
You save:  HK$310.86
CHF 89.45
List Price:  CHF 125.24
You save:  CHF 35.78
NOK kr1,141.95
List Price:  NOK kr1,598.78
You save:  NOK kr456.82
DKK kr717.64
List Price:  DKK kr1,004.72
You save:  DKK kr287.08
NZ$177.52
List Price:  NZ$248.53
You save:  NZ$71.01
د.إ367.25
List Price:  د.إ514.17
You save:  د.إ146.91
৳11,994.74
List Price:  ৳16,793.12
You save:  ৳4,798.37
₹8,496.63
List Price:  ₹11,895.62
You save:  ₹3,398.99
RM450.75
List Price:  RM631.07
You save:  RM180.32
₦155,628.43
List Price:  ₦217,886.03
You save:  ₦62,257.60
₨27,934.96
List Price:  ₨39,110.06
You save:  ₨11,175.10
฿3,444.45
List Price:  ฿4,822.37
You save:  ฿1,377.92
₺3,518.54
List Price:  ₺4,926.10
You save:  ₺1,407.55
B$617.53
List Price:  B$864.57
You save:  B$247.04
R1,837.80
List Price:  R2,572.99
You save:  R735.19
Лв188.31
List Price:  Лв263.64
You save:  Лв75.33
₩144,872.25
List Price:  ₩202,826.95
You save:  ₩57,954.69
₪364.89
List Price:  ₪510.86
You save:  ₪145.97
₱5,883.01
List Price:  ₱8,236.45
You save:  ₱2,353.44
¥15,672.80
List Price:  ¥21,942.55
You save:  ¥6,269.75
MX$2,028.91
List Price:  MX$2,840.56
You save:  MX$811.64
QR366.34
List Price:  QR512.89
You save:  QR146.55
P1,382.59
List Price:  P1,935.69
You save:  P553.09
KSh12,923.70
List Price:  KSh18,093.70
You save:  KSh5,170
E£5,091.27
List Price:  E£7,127.98
You save:  E£2,036.71
ብር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$99,155.08
List Price:  CLP$138,821.08
You save:  CLP$39,666
CN¥729.81
List Price:  CN¥1,021.77
You save:  CN¥291.95
RD$6,104.52
List Price:  RD$8,546.58
You save:  RD$2,442.05
DA13,454.60
List Price:  DA18,836.98
You save:  DA5,382.37
FJ$232.11
List Price:  FJ$324.96
You save:  FJ$92.85
Q773.21
List Price:  Q1,082.52
You save:  Q309.31
GY$21,000.46
List Price:  GY$29,401.48
You save:  GY$8,401.02
ISK kr13,903.60
List Price:  ISK kr19,465.60
You save:  ISK kr5,562
DH1,007.40
List Price:  DH1,410.40
You save:  DH403
L1,841.78
List Price:  L2,578.57
You save:  L736.78
ден5,922.50
List Price:  ден8,291.74
You save:  ден2,369.23
MOP$803.42
List Price:  MOP$1,124.82
You save:  MOP$321.40
N$1,834.70
List Price:  N$2,568.66
You save:  N$733.95
C$3,694.32
List Price:  C$5,172.20
You save:  C$1,477.87
रु13,665.58
List Price:  रु19,132.35
You save:  रु5,466.77
S/374.71
List Price:  S/524.60
You save:  S/149.89
K406.86
List Price:  K569.63
You save:  K162.76
SAR375.72
List Price:  SAR526.02
You save:  SAR150.30
ZK2,777.96
List Price:  ZK3,889.25
You save:  ZK1,111.29
L478.81
List Price:  L670.35
You save:  L191.54
Kč2,418.25
List Price:  Kč3,385.65
You save:  Kč967.40
Ft39,800.47
List Price:  Ft55,722.25
You save:  Ft15,921.78
SEK kr1,103.66
List Price:  SEK kr1,545.17
You save:  SEK kr441.50
ARS$102,190.76
List Price:  ARS$143,071.15
You save:  ARS$40,880.39
Bs693.61
List Price:  Bs971.08
You save:  Bs277.47
COP$437,799.12
List Price:  COP$612,936.28
You save:  COP$175,137.16
₡50,480.33
List Price:  ₡70,674.48
You save:  ₡20,194.15
L2,548.03
List Price:  L3,567.35
You save:  L1,019.31
₲784,126.06
List Price:  ₲1,097,807.85
You save:  ₲313,681.79
$U4,460.41
List Price:  $U6,244.75
You save:  $U1,784.34
zł409.96
List Price:  zł573.96
You save:  zł164
Already have an account? Log In

Transcript

Welcome back, everyone. Well, we did a little prep work in the last video for this video in this video our electro spark use script. Our goal is to add an event and write script to get our player casting out there electro spark offensive magic. So let's jump right to it. Let's jump to our content Metroidvania blueprints characters folder there, you'll find BP player double click on her to open her up. And we are going to be working in our black magic tab.

This is where we created the script for our shooting of the fireball. If you don't see it up here, you can access it over here in the My Blueprint panel, you should have that black magic tab right there. And if you really don't have it, you can click right there to create a new graph for black magic. So the good news here is we're going to be able to borrow, copy and paste some nodes that we created when we did our Using of the fireball script, first things first, like we did before, when we created our shoot fireball script, we created a custom event called use fireball. Down below down here I'm going to right click type in custom event and we're going to call this one use IE I'll do all cap just like I did before electro Spark. Okay, and with that created now I can slide over to the left here and we've got our input action black magic that's hooked up to a keyboard button as well is a button on our controller.

And we're going to say if our be magic slotted that is, in our player info if this be magic slot and variable is electro spark which I am manually changing to electro spark right now if it is that then off of our electric Spark, we are going to call our use II lecture Oh spark custom events. So this is just kind of a wireless signal right here to tell this custom events to fire off. Okay, right off of this event, we can copy and paste some of our nodes up above from our use fireball, which ones Well, we're going to start with this check if enough manna to use magic all the way up through this update manna function right here. So left click and drag, grab all of these right here. hit Ctrl C. And down here I'm gonna, I'm gonna give myself a little bit more room I'm gonna hit Ctrl V. Let's bring these on down a little bit lower.

And let's take our US electrical spark and plug it into the check if enough manner to use magic This is a function that we created. We need to plug in some magic attributes and for this we're going to be plugging in our electro spark attributes. And again inside of this custom function if you find it over here, it is going to extract how much man is in our electoral spark attributes. In this case, it's going to cost 25 and it's going to see Do we have enough manpower to even use the magic? Now some of these Booleans hooked up are not quite right like, is fireball ready No, we don't want to check if the fireball is ready for use electro Spark. We want to check out if you the electro spark is ready.

So what we can do here is we can simply right click on fireball ready we can say replace with and the one that I'm looking for is electro spark ready? Be electrical spark ready there. It is. That's another way you can swap out some variables I could have simply dragged and dropped it from here as well. So we're going to check if we have enough manna, we're going to check if electro spark is ready and we are also going to check if we are not using our missed ability. And if all those are true, we're going to update our manna amount.

However, we don't want our fireball attributes here assessed, we want to right click on this replace with our electrical spark attributes and make sure you swap that out. This is all fine and dandy is well. Everything's good to go there. Okay, so after we update the manner the next thing we want to do is we want to bring in our be used electro Spark. gonna left click and drag, we're going to set this I'm going to set this to be true. So if all that happens to be you know, you can use it.

We're going Say yes, we are using electro Spark. And then I'm going to take electro spark ready, the electro spark ready, we're going to set that. And we're currently going to set that to false. As in No, it's not ready anymore because we're already using it. So again, use electro spark is going to be used to drive our animations. And this one is going to be used in conjunction with electro spark cool down to determine if we can use it again.

After this, I'm gonna bring in a sequence node shortcut is to hold down the S key and left click, there is a sequence node. And now for this next bit, we need a couple of timelines or rather, we need one timeline. That's gonna have a couple of tracks inside of it. So let's right click in some empty space, searched out a time line and you'll see why here in just a little bit. We're going to call this electro Spark. I'll call it electro sparks scale even though it's going to have two tracks inside of it.

So once we call this electro sparks scale, let's double click on this timeline, we're going to add a couple of tracks inside of it first. So let's change our length here to be 1.9 seconds. The first track I'm going to add is in event tracks, you can add that by clicking right here. And I'm going to name this track disable electro collision. So what's going to happen here is we are going to spawn in our electrical spark blueprint, and then at some point along this timeline, we're going to disable the collision from that because remember that blueprint that electro spark collision blueprint that we created, did have some collision in it and just to kind of drive home In this point, there's our blueprints, our actors, our BP electrical Spark. And remember, we had this collision component right there.

And with that selected, actually, if I right click in this menu, tap the F key, I can just frame up on it. So we want to be able to wait to talk to that to tell it to turn off. Okay, let's jump back to our BP player here. Okay, so with this track created, the only thing I need to do is right click in our graph over here, I'm going to add a key doesn't really matter where you right click because we're going to hard set some time and value values here. Our time here is going to be 1.8 seconds. So if 1.8 seconds in value can be zero doesn't really matter for that because this is going to be an event that is going to be good to go.

Now if I jump out of this timeline that we are inside of right now, you can see we've added this disable electro collision, exact output pin right here where we can make something happen at that 1.8 second mark into our track. Okay, let's add another track, this one is going to be a loop to track. And I will call this one scale. And this is going to be used to scale the visual effects of our RBP electoral Spark, just to give it a little extra flair. So we're going to be adding several keys to this. Many of them in fact, five, let me flip my page and note five of them Yes.

So again, it doesn't really matter where were we right click in this graph, right click at a key. First one will be set at time zero, a value of zero. Right click again, add a second key. This one will be at time point one seconds, and a value of zero yet. Then we're going to right click again, add another Key, this one will be at time of point two, five seconds, but a value of one, it's going to jump off the graph here, but if you're right click tap that F key, it's going to frame all the keys that you got in here. Okay?

Then I am going to right click again, add a fourth key, the time for this is going to be 1.8. And the value is going to be one. And then I'm going to right click one more time again, it doesn't really matter where and with your key selected, I'm going to set my time to be 1.9 and my value to be two, okay. So you can choose right now you've got this synchronized view on where it's trying to keep your two different graphs here, synchronized. I'm just going to uncheck that and now if I right click Looking here, tap the F key, we can zoom up on all of our keys to make them all appear in view. And this is not really going that one's trying to synchronize view going to unsynchronized, tap that F key and there it is.

All of our keys right. Okay, so with our time line created, let's jump out of here. I think we've got this all looking correct. And we're not gonna be using this just yet. I'm gonna move this over to the right our timeline there you can see our scale output for our float track that we just created in the last video. Okay, so we want to build off of our then zero branch first.

So again, we're evaluating a bunch of stuff to see if it's true that we've got enough manna and stuff to even cast this. Then off of our then zero branch, we are going to say electro spark on and If you remember right, this function is going to do all this stuff primarily it is going to disable your inputs, okay? Which is important kind of need to do that jumping back to our black magic tab here. Then I'm going to bring in a slight delay. This is going to be a delay of we will say, point three seconds. So this is going to be a slight delay from the time that we cast we, we elect to say yes, we're going to cast electro spark until you see the visuals kind of flare out, okay.

And then after this, I'm going to set our use electro Spark, left click drag this in, we're going to set that to false. And again, that's going to be used to drive Some of our character animation stuff, okay, so it's gonna be turned off. Now after this don't want to use the timeline just yet, we are going to drag off of this and type in play world camera shake, kind of like we did before with our fireball, we're going to play some camera shake, we can use that same shape class that we used before the epicenter for this, let's grab our capsule component left click and drag that down into the graph. We'll drag out of that and we'll get the world location to say that's going to be the epicenter of our shake. And let's set our outer radius here to be 1000. And because our camera is positioned where it is, that should shake nicely.

Okay, right after we're playing our camera shake here we are going to spawn actor From class. And the actor that we want to spawn in is our E electro BP electro Spark. That was this fancy looking guy. Now we need to tell this, where do we want this to spawn in, we got to feed it a spawn transformation. What I'm going to do is I'm going to right click on this spawn transformation pin, and I'm going to split it. And that's going to allow me to extract the or basically specify the location, the rotation and the scale, I'm going to say the location that I want this to play is going to be a modified location from our world location.

I'm going to drag off of our capital components world location, hit the plus symbol, and I'm looking for vector plus vector and I'm simply going to add 150 to the z value. So I basically want to spawn this BP electric spark up above a little bit where our capsule component is that surrounds our character. Now the spawn transform rotation that can stay on zeros as can this scale that's all well and good. Okay moving along after this, we now want to plug into our electrical spark timeline. I'm going to plug this into play from start so that we ensure that this is always going to play from the beginning. Now off of this Well, let's see there's multiple things we can do here.

Let's do this. First, let's drag off of our spawn BP electro Spark, off of the return value. I'm going to drag off and get the collision get its collision and by that I am referring specifically To this component in our BP lecture, Spark, our collision component, okay, jumping back to our BP player. And one thing I want to do is dragging off of this, I want to type in set collision enabled. And once we've hit the point 1.8 seconds into our timeline, our event timeline had at 1.8 seconds in, we wanted to disable the electrodes collision. So that's one thing we wanted to do.

Another thing I wanted to do is after this timeline is finished, I want to drag off of our BP lecture spark and I'm gonna say destroy the actor. So once this 1.9 seconds is passed here, or you're gonna say bye bye BP electric Spark. You're gone. Now while this is going on, we want something to happen. And the thing we want to happen is we want to take our collision component here, drag off of this, we want to type in set world scale 3d. So while this timeline is playing, we're going to update the world scale of our collision component.

And we're going to update it. By this amount, we're specifying with our scale float, we can simply apply this to this vector input. And so that's going to scale it appropriately. Now, if you remember right here in our timeline, let me just kind of shrink this a little bit easier. So you can see this. There it is.

Oh, it's being so so difficult. Okay, so we can see that at the very end for example, we are going to be taking this and going two times the size at 1.8 is going to be at 1.0 size, basically its normal size. At the very beginning, this first key is obviously very small, very small, even a 10th of a second and then from a 10th of a second to a quarter of a second. We're going to be scaling it up to its usual size. Okay, we are not quite finished with this yet. Let's jump back to our black magic.

We got one more bit of script to add off of our then one pin

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.