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
€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 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.