BP Scripting - Parent Target #2

15 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
€93.07
List Price:  €130.30
You save:  €37.23
£79.62
List Price:  £111.47
You save:  £31.85
CA$136.60
List Price:  CA$191.24
You save:  CA$54.64
A$151.87
List Price:  A$212.63
You save:  A$60.75
S$135.20
List Price:  S$189.29
You save:  S$54.08
HK$781.33
List Price:  HK$1,093.90
You save:  HK$312.56
CHF 90.72
List Price:  CHF 127.01
You save:  CHF 36.29
NOK kr1,092.46
List Price:  NOK kr1,529.50
You save:  NOK kr437.03
DKK kr694.20
List Price:  DKK kr971.90
You save:  DKK kr277.70
NZ$167.15
List Price:  NZ$234.02
You save:  NZ$66.86
د.إ367.25
List Price:  د.إ514.16
You save:  د.إ146.91
৳10,946.16
List Price:  ৳15,325.07
You save:  ৳4,378.90
₹8,342.71
List Price:  ₹11,680.13
You save:  ₹3,337.42
RM473.95
List Price:  RM663.55
You save:  RM189.60
₦123,487.65
List Price:  ₦172,887.65
You save:  ₦49,400
₨27,847.21
List Price:  ₨38,987.21
You save:  ₨11,140
฿3,679.53
List Price:  ฿5,151.49
You save:  ฿1,471.96
₺3,232.18
List Price:  ₺4,525.18
You save:  ₺1,293
B$511.10
List Price:  B$715.57
You save:  B$204.46
R1,851.52
List Price:  R2,592.21
You save:  R740.68
Лв181.98
List Price:  Лв254.78
You save:  Лв72.80
₩135,881.87
List Price:  ₩190,240.05
You save:  ₩54,358.18
₪371.60
List Price:  ₪520.25
You save:  ₪148.65
₱5,713.97
List Price:  ₱7,999.79
You save:  ₱2,285.82
¥15,308.41
List Price:  ¥21,432.39
You save:  ¥6,123.98
MX$1,693.57
List Price:  MX$2,371.07
You save:  MX$677.49
QR364.01
List Price:  QR509.63
You save:  QR145.62
P1,365.33
List Price:  P1,911.52
You save:  P546.18
KSh13,468.65
List Price:  KSh18,856.65
You save:  KSh5,388
E£4,794.02
List Price:  E£6,711.82
You save:  E£1,917.80
ብር5,699.43
List Price:  ብር7,979.43
You save:  ብር2,280
Kz83,741.62
List Price:  Kz117,241.62
You save:  Kz33,500
CLP$94,755.52
List Price:  CLP$132,661.52
You save:  CLP$37,906
CN¥723.62
List Price:  CN¥1,013.10
You save:  CN¥289.48
RD$5,785.38
List Price:  RD$8,099.76
You save:  RD$2,314.38
DA13,457.99
List Price:  DA18,841.73
You save:  DA5,383.73
FJ$225.30
List Price:  FJ$315.43
You save:  FJ$90.13
Q775.21
List Price:  Q1,085.33
You save:  Q310.11
GY$20,876.73
List Price:  GY$29,228.26
You save:  GY$8,351.52
ISK kr13,989.60
List Price:  ISK kr19,586
You save:  ISK kr5,596.40
DH1,008.69
List Price:  DH1,412.20
You save:  DH403.51
L1,771.31
List Price:  L2,479.90
You save:  L708.59
ден5,730.13
List Price:  ден8,022.42
You save:  ден2,292.28
MOP$803.11
List Price:  MOP$1,124.38
You save:  MOP$321.27
N$1,860.85
List Price:  N$2,605.27
You save:  N$744.41
C$3,673.63
List Price:  C$5,143.23
You save:  C$1,469.60
रु13,311.40
List Price:  रु18,636.50
You save:  रु5,325.09
S/375.46
List Price:  S/525.66
You save:  S/150.20
K383.63
List Price:  K537.10
You save:  K153.47
SAR375.03
List Price:  SAR525.05
You save:  SAR150.02
ZK2,685.42
List Price:  ZK3,759.69
You save:  ZK1,074.27
L463.14
List Price:  L648.42
You save:  L185.27
Kč2,328.17
List Price:  Kč3,259.54
You save:  Kč931.36
Ft36,248.95
List Price:  Ft50,749.98
You save:  Ft14,501.03
SEK kr1,083.98
List Price:  SEK kr1,517.62
You save:  SEK kr433.63
ARS$87,816.53
List Price:  ARS$122,946.66
You save:  ARS$35,130.12
Bs689.12
List Price:  Bs964.79
You save:  Bs275.67
COP$389,940.87
List Price:  COP$545,932.82
You save:  COP$155,991.94
₡50,893.45
List Price:  ₡71,252.86
You save:  ₡20,359.41
L2,475.75
List Price:  L3,466.15
You save:  L990.40
₲747,391.81
List Price:  ₲1,046,378.43
You save:  ₲298,986.62
$U3,833.15
List Price:  $U5,366.56
You save:  $U1,533.41
zł402.67
List Price:  zł563.75
You save:  zł161.08
Already have an account? Log In

Transcript

Okay, so now we do want this trigger volume to do something when we overlap it. So let's right click on this trigger volume, add an event for on component begin overlap. And the first thing as we've been doing for a lot of these is we want to check what was the thing that is overlapping this trigger volume, this box shape right there. We're going to drag a wire out of the other actor and do that cast to first person to ensure that it was a first person character that overlapped it. Then what we're going to do is drag in another reference to our standalone target. I'm just going to hold down Ctrl and left click to bring in a getter right away.

In out of it, I will drag out a wire Find a branch. And if this is labeled as a standalone target I want to do once right there. And what do I want to do, I want to basically find our targets, our point value, and our spotlights. And I want to drag a wire on any one of those and I want to set visibility. Plug all three of these into the target and make sure that you check this new visibility box. So again, what we're saying here is, as soon as we do overlap this trigger volume, we do want to show the target the point value in the spotlight Now, one thing I want to make clear is I know there right now this trigger volume that we're asking the point The overlap is kind of overlapping our target here.

Isn't that a little weird, Mr. quandra? I mean, like, what if this targets way up in the air? How's the player ever going to overlap that? Well, once we place these in the level, we will be able to move this trigger volume independently of the rest of this blueprint. So just know that we can move this box down into the right any place we want to put it. Okay, so let's continue on here.

So we're setting that visibility to be true. Next, let's get our target collision. Let's talk to that guy. And let's do set collision enabled. And for the collision type, let's set it to be query only. That'll enable some collision.

And continuing on what do we want to do next we are going to bring out a something called a sequence node. Drag we're out of here sequence Because we're going to have two things that we want to do, and I'm gonna break, I'm gonna branch off this top, then one first, and then we'll deal with this a little later. So the first thing I want to do is I want to let's play a sound, play a sound 2d, and the sound that I want is called possess, possess player Q. That's a nice sort of spani sound effect. And then I'm gonna want to plug this into a timeline. So go ahead and find a timeline node.

And let's call this timeline spawn. Animation, we're going to play a really short spawn animation for when the target pops into existence. We will deal with this in just a little bit. Actually, you know what, let's deal with it now. So let's back this up. up again real quickly.

Player overlaps that trigger volume we are checking again isn't labeled as a standalone target. If it is we want to one time set the visibility of our target point value in spotlight to be true. turn our target collision on so we can now shoot the target. Then we're going to play that spawning sound effect and we want to do a spawn animation. Let's double click on this guy and create a spawn animation. Okay, we're going to have a relatively short animation here.

Let's go with the length of point three seconds. We will be creating a float track. Let's name it. rotation. And let's add let's add three keys in here. So I'm going to hold down the shift key and left click Once left click twice and left click a third time.

And note that I don't really care where I place these keys here to begin with because I am going to be manually setting them. So I'm going to select this first key and I'm going to give it a time of zero and a value of zero. Selecting our second key, I will give it a time of point one five seconds and a value of 1.5. And then I will select our third key here. Set the time to be whoops, set the time to be point three and the value to be one. And let me just hold down Control and use my mouse wheel to scroll way back and we're going to left click drag on a marquee selection to select all those keys and click on these two arrows to frame that into view.

Then with all those selected, I'm also going to right click on any of these keys and set my key interpolation to be auto. That's going to create this sort of smooth animation of a target kind of spinning into existence that I will demo for you when we're just about done here. Okay, so let's hop on back to our Event Graph. And now we've got this rotational float value that we can pull out of. But first, before we even deal with that, let's talk to the thing that we actually want to animate here. And that's going to be our target collision.

And why do we want to animate this thing, because all of these guys are attached to it. So if we animate this kind of spin it into into existence, all these are going to come along for the ride. So I'm just gonna left click and drag drag this out here. And then I am going to drag out a wire here and do sets, sets relative. You know what, let's scale the size of this target. Let's make that the animation I was going to kind of rotate it into existence.

But you know what I think I'm going to scale it into existence instead. So let's come back in our spawn animation and let's change this instead of saying rotation. let's right click this and rename this to scale. I think that's what I was intending all along, but I messed up in my notes here, so bear with me, we're gonna scale that. So then out of our target collision, let's just left click and drag and let's do a search for a set, relative scale 3d. And what if we could plug this in right away, but I don't want to do that just yet, there is a safety check I want to do there.

Let's just take our scale and plug this right into our new scale 3d. So it's gonna bring in this little conversion node. And basically that scale is going to get applied to the X, Y, and Z of the new scale 3d. So we're going to essentially scale our collision or our target from a point of nothing to something a little bit bigger and then shrink it back down again. Between these two, what I want to do is I want to drag out or actually it's right click and bring in a reference to self. We want to talk to ourselves.

Don't we always out of this, I'm going to drag out a wire and do a story. For is a valid and there's two different nodes here you want to choose the one with the question mark. And the way we're going to hook this up is on our update, we are going to plug this into here and out of the is valid. We are going to plug this into here, let's understand what we're doing. We have this spawn animation that is going to take point three seconds and it's going to essentially scale the size of our target from basically an infinitely small point to target one and a half times its normal size and back to a relatively normal size. During that time a player could technically shoot the target.

If this is not in here, you're going to get some warnings yelling at you saying hey we could not find the target collision because you have already destroyed this target. So know that this is a safety check to save you from Some errors later on. Okay, so that's all we want to do out of this top sequence branch. Let's pull out of the bottom portion of the sequence branch. And I want to start by bringing a wire out of the then one and let's do a search for a delay node. And I want to set our delay to be the time that is contained within our lifetime variable.

Because what we are going to do here is drag out another wire bringing another sequence node and onto the top, then zero. I'm gonna plug this into the reverse of our spawn animation. And don't worry, I'll come back and explain that in just a moment. And then I'll get out of the ventilator. One I'm going to drag a wire out, set a another delay 4.3 seconds to 0.3 seconds. And then we are going to destroy the actor which is the target.

Now a few things I want to point out what we're doing here let's in fact let's back this all the way up. Upon overlapping a trigger volume we're going to check if it's the first person character We're then going to ask was this a standalone target was that target labeled as a standalone target? If it was one time, we want to set the visibility of our target our point value in our spotlight to show to be visible. We're also going to make it so that we can actually shoot the target by enabling some collision. Then we are going to play a sound effect, a spawning sound effect the spawn animal Which is 0.3 seconds we'll play. First we'll check to make sure that the target has not already been destroyed because its spawn animation is 0.3 seconds.

And over the course of 0.3 seconds we are going to scale the size of our target collision, which is the parent of everything else here. So it will scale it from basically a scale size of zero, up to one and a half times its size and then down to it's 100% its normal size. And while we are playing the spawn animation, we are then beginning a countdown, a 10 second countdown in this case our lifetime and after this delay of 10 seconds happens what we are going to do is reverse our spawn animation. And after this same time of reversing our spawn animation 0.3 seconds We are going to destroy the actor. Hopefully that all makes sense. Let's Compile and Save.

And then let's come over into the level editor and give this a whirl. Now I should be able to drag in any one of our targets here because remember, they're all children of our BP target parent. I'll start with BP target 100. Drag that guy in. And notice with it selected over in the Details panel, you see fields to customize how many points it's worth, the lifetime that it will stay active or alive. And if it is a standalone target, I do want to check this by checking this remember our script is saying it will not be visible at the outset of a level.

Let me just drag this up into the air a little bit. I'm going to pivot this around. We're going to put this to the test right away. Kinda In the error over here. Now notice, with this selected in the Details panel, if you kind of drag this portion of the Details panel down, it's a little hidden, you can reveal all of the components of that blueprint. And this is where the magic really happens, you can select your trigger volume.

And just with the trigger volume selected, you can move that one component around into your level wherever you want it. So I'm going to set this down on the ground, I'm going to scale it a little bit to make it easy for our player to overlap it. And then I'm going to pull it way back here. Right about there, so that when our player starts in the beginning of the level, he's going to come down this alleyway is going to overlap this and as soon as he overlaps this volume, look right in this area because this should spawn in. Now remember, I've got this set to spawn. Let me just select my target here, it's supposed to stay alive for 10 seconds and go away now, I can actually shoot it and destroy it just yet that script is to come.

But let me set my lifetime here to be five seconds because that's all we need to see it go away. Alright, let's jump in and play and see well we got you have to open F to open. A little damage now watch right about there. Boom, target comes into existence. Five seconds pass cannot shoot it yet. then boom, it goes away.

Everything Is Working superbly awesome. In the next one, we will actually script some more functionality for our parents target so that all the children can inherit from it, so that target can be destroyed. We will see you guys in the next video.

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.