Fireball - Damage Script

9 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.11
List Price:  €128.95
You save:  €36.84
£79
List Price:  £110.60
You save:  £31.60
CA$135.63
List Price:  CA$189.89
You save:  CA$54.26
A$152.50
List Price:  A$213.51
You save:  A$61
S$134.36
List Price:  S$188.12
You save:  S$53.75
HK$782.24
List Price:  HK$1,095.17
You save:  HK$312.93
CHF 90.03
List Price:  CHF 126.05
You save:  CHF 36.01
NOK kr1,071.43
List Price:  NOK kr1,500.05
You save:  NOK kr428.61
DKK kr686.90
List Price:  DKK kr961.68
You save:  DKK kr274.78
NZ$165.89
List Price:  NZ$232.25
You save:  NZ$66.36
د.إ367.19
List Price:  د.إ514.08
You save:  د.إ146.89
৳10,962.37
List Price:  ৳15,347.75
You save:  ৳4,385.38
₹8,329.89
List Price:  ₹11,662.18
You save:  ₹3,332.29
RM471.95
List Price:  RM660.75
You save:  RM188.80
₦139,650.03
List Price:  ₦195,515.63
You save:  ₦55,865.60
₨27,784.55
List Price:  ₨38,899.49
You save:  ₨11,114.93
฿3,624.68
List Price:  ฿5,074.70
You save:  ฿1,450.02
₺3,219.22
List Price:  ₺4,507.05
You save:  ₺1,287.82
B$497.37
List Price:  B$696.33
You save:  B$198.96
R1,892.69
List Price:  R2,649.84
You save:  R757.15
Лв180.23
List Price:  Лв252.33
You save:  Лв72.09
₩133,970.85
List Price:  ₩187,564.55
You save:  ₩53,593.70
₪365.45
List Price:  ₪511.65
You save:  ₪146.19
₱5,625.38
List Price:  ₱7,875.76
You save:  ₱2,250.38
¥15,126.18
List Price:  ¥21,177.26
You save:  ¥6,051.08
MX$1,667.89
List Price:  MX$2,335.11
You save:  MX$667.22
QR364.33
List Price:  QR510.08
You save:  QR145.74
P1,371.04
List Price:  P1,919.52
You save:  P548.47
KSh13,198.68
List Price:  KSh18,478.68
You save:  KSh5,280
E£4,777.57
List Price:  E£6,688.79
You save:  E£1,911.22
ብር5,674.28
List Price:  ብር7,944.22
You save:  ብር2,269.94
Kz83,679.39
List Price:  Kz117,154.50
You save:  Kz33,475.10
CLP$97,728.22
List Price:  CLP$136,823.42
You save:  CLP$39,095.20
CN¥721.76
List Price:  CN¥1,010.50
You save:  CN¥288.73
RD$5,902.41
List Price:  RD$8,263.61
You save:  RD$2,361.20
DA13,448.48
List Price:  DA18,828.42
You save:  DA5,379.93
FJ$224.75
List Price:  FJ$314.66
You save:  FJ$89.91
Q779.03
List Price:  Q1,090.67
You save:  Q311.64
GY$20,896.29
List Price:  GY$29,255.65
You save:  GY$8,359.35
ISK kr13,751.62
List Price:  ISK kr19,252.82
You save:  ISK kr5,501.20
DH1,006.38
List Price:  DH1,408.98
You save:  DH402.59
L1,764.74
List Price:  L2,470.71
You save:  L705.96
ден5,675.43
List Price:  ден7,945.83
You save:  ден2,270.40
MOP$804.72
List Price:  MOP$1,126.64
You save:  MOP$321.92
N$1,894.31
List Price:  N$2,652.11
You save:  N$757.80
C$3,675.64
List Price:  C$5,146.05
You save:  C$1,470.40
रु13,325.57
List Price:  रु18,656.33
You save:  रु5,330.76
S/369.95
List Price:  S/517.94
You save:  S/147.99
K377.16
List Price:  K528.04
You save:  K150.88
SAR375.02
List Price:  SAR525.05
You save:  SAR150.02
ZK2,674.30
List Price:  ZK3,744.12
You save:  ZK1,069.82
L457.86
List Price:  L641.02
You save:  L183.16
Kč2,326.20
List Price:  Kč3,256.78
You save:  Kč930.57
Ft36,514.89
List Price:  Ft51,122.31
You save:  Ft14,607.42
SEK kr1,054.76
List Price:  SEK kr1,476.71
You save:  SEK kr421.94
ARS$85,616.43
List Price:  ARS$119,866.43
You save:  ARS$34,249.99
Bs690.20
List Price:  Bs966.32
You save:  Bs276.11
COP$388,387.97
List Price:  COP$543,758.70
You save:  COP$155,370.72
₡50,196.77
List Price:  ₡70,277.49
You save:  ₡20,080.71
L2,465.93
List Price:  L3,452.40
You save:  L986.47
₲734,141.46
List Price:  ₲1,027,827.41
You save:  ₲293,685.95
$U3,790.30
List Price:  $U5,306.57
You save:  $U1,516.27
zł397.21
List Price:  zł556.12
You save:  zł158.90
Already have an account? Log In

Transcript

Welcome back once again everyone in this video we are going to be doing some work inside of our BP firewall blueprint, we're going to be writing a script that will cause damage to any actor that we intend to receive damage such as an enemy. Now, a little bit later on in this course, we will be creating a dummy enemy to test this against. But we're going to go ahead and create this hit fireball script right now so that we get this out of the way. Come under your Metroidvania blueprints actors folder, find your BP fireball, double click on it to open it up. And here in the Event Graph, we have some events by default that I'm going to left click and drag and delete out because we want a different sort of event here. I'm going to right click and search for an event.

Hit that guy right there. We want something to happen. When we detect that this blueprint hits something else, and the first thing I want to do when we detect this hit something else is to drag off our execution wire here and do a spawn emitter at location, I want to play some kind of emitter at the point where it hits something. The jmeter template that I'm going to plug in here is going to be known as fire ball underscore strong. You're looking for this P fireball strong HMAS flash now, this is in the Infinity Blade effects pack. And again, if this effects pack is no longer available to you, when you view this video, you can use anything you want.

Now we need to see this a location where do we want this to spawn? Well, when we detect that this BP fireball hits something it is going to output tell us where the hit location is. So we can feed this into the input inputs of our spawn emitter at location. Okay, and anytime you spawn any jmeter you have any jmeter playing, you usually want to accompany it with Dragon off of here a play have capslock on play sound at location. Let's feed this the same location as our event. And we want to put in here the explosion explosion queue.

This is a sound that's in the current Li available Starter Content. I use it quite a lot for demonstration. Okay, the next thing I want to do after we spawn emitter and play a sound is to drag off of here and let's type in play world camera shake. That's the node that you're looking for and wouldn't you know it? In the last video, we created a camera shake blueprints, so we can slot that in right here where it's looking for a shake There's our BP camera shake. And it needs to know what do we want is the epicenter for where this is going to play where's this camera shake going to be centered on.

So I'm going to take the hits location, plug it into our Epicenter here. Now our camera is further away than the epicenter as to where this fireball is going to impact so I'm gonna set the outer radius here to be 1000 and based upon how we have our camera setup, we should be able to see our camera shake just fine. Okay, continuing on with our scripts here, right after this after we play the world camera shake, we are going to destroy the actor. In this case, we are saying we want to destroy ourselves this BP fireball so upon impact fireball go, bye bye. Now after this, I'm going to right click get Player Character. And then we are going to Drag off the Return Value here in cast to our BP player.

Like so. And then out of our MVP player, I'm going to drag out and type in fireball attributes attributes, we want to get our fireball attributes variable that's located inside of our BP player blueprint. And I want to drag off this insane break. Remember, that's a struct variable. So it contains a lot of information inside of it. And I'm going to expand this down like so.

The thing I'm trying to get to is our damage amount. Now back in our BP player, just going to click over here, you don't have to do this. This is just to show you. Here's our BP player. overlong the left hand side we've got our magic black fireball here are our fireball attributes that struct variable. And here we're saying that our fireball is going to do 50 damage now this is the number that we're trying to get it over here in our BP fireball.

So here's our fireball attributes, we're breaking this open and we want to access that damage amount that we're storing in this fireball attributes variable. Now what are we going to feed this into? Well, we're going to feed this into right clicking a node called apply damage. So this damage output goes into the base damage of the applied damage. Make sure you keep your ex whoops hold on that was not intended. Take your flow of execution here plug it into the apply damage.

Now one thing we do have to feed in is which actor do we want? to damage well, where we get this from the input for this is going to come way back over here in our event hit. When we hit something it can output what is the other actor object reference that we hit. So we can drag this all the way on over to our damage actor to say that is the actor that we want to damage now this wire is rather unsightly. So what I'm going to do is I'm going to create a couple reroute nodes here by double clicking on this line. We'll drag that down.

And then over to the right here I will also create a nother reroute node to kind of snake this around like so. Okay, so just kind of showing you the script that we have here. Let's kind of run through it here quickly. Event hit We're going to feed the location into a spawn emitter at location. That is our P fireball strong muzzle flash, then we're going to play a sound at location, our explosion Q, then we're going to play our world camera shake our BP camera shake. Then we're going to destroy the actor ourselves as BP fireball, then we're going to get the beaver caster, our BP player here so that we can access our fireball attributes and know how much damage it's meant to do.

And then apply that amount of damage to the actor that this fireball actually hits. Okay, let's quickly Compile and Save here. And the thing I really want to test here is to see if we have a particle effect, a sound effect and some camera shake going on the whole applying damage. We'll explore that later when we create a dummy enemy. So what how I'm going to test this is I'm going to jump back into my test map here. I am going to place I'm just going to place I guess a basic cue bout here in my level drag and drop that in hit to the end key to snap it down to the floor and then I'm just going to hit my spacebar and scale this up like so and like so so that I've got a little bit of a wall here and then let's click play and test this out.

Okay So currently, I still have my magic slotted as the fireball so I don't actually have to collect the dice but let's see how this goes when it impacts a wall here. Alright, so you see the impact effect you hear the impact effect and you see the screen shake a little so job well done guys are fireball script here is complete. Let's left click, drag around all this tap the C key and we'll simply call this hits fireball script, Compile and Save one more time. Well guys that is going to do it for our fireball series of scripts here on to the electro sparks section. We will see you there

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.