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
€92.30
List Price:  €129.22
You save:  €36.92
£79.14
List Price:  £110.81
You save:  £31.66
CA$135.92
List Price:  CA$190.30
You save:  CA$54.37
A$153.17
List Price:  A$214.44
You save:  A$61.27
S$134.71
List Price:  S$188.59
You save:  S$53.88
HK$782.26
List Price:  HK$1,095.19
You save:  HK$312.93
CHF 90.56
List Price:  CHF 126.79
You save:  CHF 36.22
NOK kr1,076.34
List Price:  NOK kr1,506.92
You save:  NOK kr430.58
DKK kr688.47
List Price:  DKK kr963.88
You save:  DKK kr275.41
NZ$166.49
List Price:  NZ$233.09
You save:  NZ$66.60
د.إ367.19
List Price:  د.إ514.08
You save:  د.إ146.89
৳11,000.23
List Price:  ৳15,400.77
You save:  ৳4,400.53
₹8,335.05
List Price:  ₹11,669.40
You save:  ₹3,334.35
RM473.25
List Price:  RM662.57
You save:  RM189.32
₦139,656.03
List Price:  ₦195,524.03
You save:  ₦55,868
₨27,872.43
List Price:  ₨39,022.53
You save:  ₨11,150.09
฿3,637.73
List Price:  ฿5,092.97
You save:  ฿1,455.24
₺3,222.80
List Price:  ₺4,512.05
You save:  ₺1,289.25
B$497.67
List Price:  B$696.75
You save:  B$199.08
R1,888.37
List Price:  R2,643.79
You save:  R755.42
Лв180.67
List Price:  Лв252.95
You save:  Лв72.27
₩134,942
List Price:  ₩188,924.20
You save:  ₩53,982.20
₪366.06
List Price:  ₪512.51
You save:  ₪146.44
₱5,625.18
List Price:  ₱7,875.48
You save:  ₱2,250.29
¥15,118.78
List Price:  ¥21,166.90
You save:  ¥6,048.12
MX$1,663.06
List Price:  MX$2,328.35
You save:  MX$665.29
QR365.44
List Price:  QR511.63
You save:  QR146.19
P1,373.02
List Price:  P1,922.28
You save:  P549.26
KSh13,148.68
List Price:  KSh18,408.68
You save:  KSh5,260
E£4,723.53
List Price:  E£6,613.14
You save:  E£1,889.60
ብር5,694.53
List Price:  ብር7,972.57
You save:  ብር2,278.04
Kz83,612.73
List Price:  Kz117,061.17
You save:  Kz33,448.44
CLP$98,024.19
List Price:  CLP$137,237.79
You save:  CLP$39,213.60
CN¥722.49
List Price:  CN¥1,011.52
You save:  CN¥289.02
RD$5,928.03
List Price:  RD$8,299.48
You save:  RD$2,371.45
DA13,469.95
List Price:  DA18,858.47
You save:  DA5,388.52
FJ$225.25
List Price:  FJ$315.36
You save:  FJ$90.11
Q781.84
List Price:  Q1,094.62
You save:  Q312.77
GY$20,987.69
List Price:  GY$29,383.60
You save:  GY$8,395.91
ISK kr13,817.61
List Price:  ISK kr19,345.21
You save:  ISK kr5,527.60
DH1,010.57
List Price:  DH1,414.84
You save:  DH404.26
L1,763.81
List Price:  L2,469.40
You save:  L705.59
ден5,677.01
List Price:  ден7,948.05
You save:  ден2,271.03
MOP$807.66
List Price:  MOP$1,130.76
You save:  MOP$323.09
N$1,895.98
List Price:  N$2,654.45
You save:  N$758.46
C$3,689.21
List Price:  C$5,165.04
You save:  C$1,475.83
रु13,357.88
List Price:  रु18,701.57
You save:  रु5,343.68
S/371.02
List Price:  S/519.45
You save:  S/148.42
K383.60
List Price:  K537.05
You save:  K153.45
SAR375.02
List Price:  SAR525.04
You save:  SAR150.02
ZK2,548.47
List Price:  ZK3,567.96
You save:  ZK1,019.49
L458.83
List Price:  L642.38
You save:  L183.55
Kč2,334.38
List Price:  Kč3,268.22
You save:  Kč933.84
Ft36,425.52
List Price:  Ft50,997.18
You save:  Ft14,571.66
SEK kr1,059.50
List Price:  SEK kr1,483.35
You save:  SEK kr423.84
ARS$85,666.43
List Price:  ARS$119,936.42
You save:  ARS$34,269.99
Bs695.09
List Price:  Bs973.16
You save:  Bs278.06
COP$389,673.99
List Price:  COP$545,559.18
You save:  COP$155,885.18
₡50,509.65
List Price:  ₡70,715.54
You save:  ₡20,205.88
L2,474.33
List Price:  L3,464.17
You save:  L989.83
₲736,638.54
List Price:  ₲1,031,323.43
You save:  ₲294,684.88
$U3,781
List Price:  $U5,293.55
You save:  $U1,512.55
zł398.17
List Price:  zł557.46
You save:  zł159.28
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.