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
€94.79
List Price:  €132.71
You save:  €37.92
£78.97
List Price:  £110.56
You save:  £31.59
CA$139.89
List Price:  CA$195.85
You save:  CA$55.96
A$153.73
List Price:  A$215.23
You save:  A$61.50
S$134.32
List Price:  S$188.05
You save:  S$53.73
HK$778.26
List Price:  HK$1,089.59
You save:  HK$311.33
CHF 88.57
List Price:  CHF 124
You save:  CHF 35.43
NOK kr1,105.08
List Price:  NOK kr1,547.16
You save:  NOK kr442.07
DKK kr706.99
List Price:  DKK kr989.82
You save:  DKK kr282.82
NZ$170.06
List Price:  NZ$238.10
You save:  NZ$68.03
د.إ367.26
List Price:  د.إ514.17
You save:  د.إ146.91
৳11,906.24
List Price:  ৳16,669.22
You save:  ৳4,762.97
₹8,436.24
List Price:  ₹11,811.08
You save:  ₹3,374.83
RM447.10
List Price:  RM625.96
You save:  RM178.86
₦167,464.25
List Price:  ₦234,456.65
You save:  ₦66,992.40
₨27,687.73
List Price:  ₨38,763.93
You save:  ₨11,076.20
฿3,470.35
List Price:  ฿4,858.63
You save:  ฿1,388.28
₺3,445.98
List Price:  ₺4,824.51
You save:  ₺1,378.53
B$578.68
List Price:  B$810.17
You save:  B$231.49
R1,810.53
List Price:  R2,534.81
You save:  R724.28
Лв185.34
List Price:  Лв259.49
You save:  Лв74.14
₩139,691.42
List Price:  ₩195,573.58
You save:  ₩55,882.15
₪373.67
List Price:  ₪523.15
You save:  ₪149.48
₱5,901.36
List Price:  ₱8,262.14
You save:  ₱2,360.78
¥15,574.86
List Price:  ¥21,805.43
You save:  ¥6,230.57
MX$2,020.46
List Price:  MX$2,828.72
You save:  MX$808.26
QR363.35
List Price:  QR508.71
You save:  QR145.35
P1,355.53
List Price:  P1,897.79
You save:  P542.26
KSh12,948.70
List Price:  KSh18,128.70
You save:  KSh5,180
E£4,969.50
List Price:  E£6,957.50
You save:  E£1,988
ብር12,262.61
List Price:  ብር17,168.15
You save:  ብር4,905.53
Kz91,256.94
List Price:  Kz127,763.36
You save:  Kz36,506.42
CLP$97,119.28
List Price:  CLP$135,970.88
You save:  CLP$38,851.60
CN¥724.58
List Price:  CN¥1,014.45
You save:  CN¥289.86
RD$6,000.34
List Price:  RD$8,400.72
You save:  RD$2,400.37
DA13,341.73
List Price:  DA18,678.95
You save:  DA5,337.22
FJ$227.04
List Price:  FJ$317.87
You save:  FJ$90.82
Q769.16
List Price:  Q1,076.85
You save:  Q307.69
GY$20,834.51
List Price:  GY$29,169.15
You save:  GY$8,334.63
ISK kr13,772.62
List Price:  ISK kr19,282.22
You save:  ISK kr5,509.60
DH995.44
List Price:  DH1,393.66
You save:  DH398.21
L1,819.82
List Price:  L2,547.83
You save:  L728
ден5,825.40
List Price:  ден8,155.79
You save:  ден2,330.39
MOP$798.74
List Price:  MOP$1,118.27
You save:  MOP$319.52
N$1,801.35
List Price:  N$2,521.97
You save:  N$720.61
C$3,666.61
List Price:  C$5,133.40
You save:  C$1,466.79
रु13,462.23
List Price:  रु18,847.67
You save:  रु5,385.43
S/378.10
List Price:  S/529.35
You save:  S/151.25
K400.90
List Price:  K561.28
You save:  K160.37
SAR375.38
List Price:  SAR525.55
You save:  SAR150.16
ZK2,752.36
List Price:  ZK3,853.42
You save:  ZK1,101.05
L471.69
List Price:  L660.38
You save:  L188.69
Kč2,395.79
List Price:  Kč3,354.20
You save:  Kč958.41
Ft38,840.72
List Price:  Ft54,378.57
You save:  Ft15,537.84
SEK kr1,099.74
List Price:  SEK kr1,539.68
You save:  SEK kr439.94
ARS$100,165.56
List Price:  ARS$140,235.79
You save:  ARS$40,070.23
Bs690.96
List Price:  Bs967.37
You save:  Bs276.41
COP$440,690.82
List Price:  COP$616,984.78
You save:  COP$176,293.95
₡50,645.88
List Price:  ₡70,906.26
You save:  ₡20,260.37
L2,517.41
List Price:  L3,524.47
You save:  L1,007.06
₲775,966.15
List Price:  ₲1,086,383.66
You save:  ₲310,417.50
$U4,274.58
List Price:  $U5,984.58
You save:  $U1,710
zł411.21
List Price:  zł575.71
You save:  zł164.50
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.