Character Land Script

13 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.78
List Price:  €129.90
You save:  €37.11
£79.40
List Price:  £111.16
You save:  £31.76
CA$136.11
List Price:  CA$190.56
You save:  CA$54.44
A$154.13
List Price:  A$215.78
You save:  A$61.65
S$135.08
List Price:  S$189.12
You save:  S$54.03
HK$782.28
List Price:  HK$1,095.23
You save:  HK$312.94
CHF 90.61
List Price:  CHF 126.85
You save:  CHF 36.24
NOK kr1,085.23
List Price:  NOK kr1,519.37
You save:  NOK kr434.13
DKK kr692.01
List Price:  DKK kr968.84
You save:  DKK kr276.83
NZ$167.80
List Price:  NZ$234.94
You save:  NZ$67.13
د.إ367.19
List Price:  د.إ514.08
You save:  د.إ146.89
৳10,976.08
List Price:  ৳15,366.96
You save:  ৳4,390.87
₹8,339.52
List Price:  ₹11,675.66
You save:  ₹3,336.14
RM473.25
List Price:  RM662.57
You save:  RM189.32
₦141,842.81
List Price:  ₦198,585.61
You save:  ₦56,742.80
₨27,810.04
List Price:  ₨38,935.18
You save:  ₨11,125.13
฿3,647.70
List Price:  ฿5,106.92
You save:  ฿1,459.22
₺3,232.12
List Price:  ₺4,525.11
You save:  ₺1,292.98
B$499.21
List Price:  B$698.91
You save:  B$199.70
R1,908.54
List Price:  R2,672.04
You save:  R763.49
Лв180.65
List Price:  Лв252.92
You save:  Лв72.26
₩135,197.71
List Price:  ₩189,282.20
You save:  ₩54,084.49
₪368.63
List Price:  ₪516.10
You save:  ₪147.47
₱5,633.91
List Price:  ₱7,887.71
You save:  ₱2,253.79
¥15,144.47
List Price:  ¥21,202.86
You save:  ¥6,058.39
MX$1,659.40
List Price:  MX$2,323.22
You save:  MX$663.82
QR364.31
List Price:  QR510.04
You save:  QR145.73
P1,370.91
List Price:  P1,919.33
You save:  P548.42
KSh13,148.68
List Price:  KSh18,408.68
You save:  KSh5,260
E£4,729.52
List Price:  E£6,621.52
You save:  E£1,892
ብር5,680.63
List Price:  ብር7,953.11
You save:  ብር2,272.48
Kz83,612.74
List Price:  Kz117,061.18
You save:  Kz33,448.44
CLP$97,978.20
List Price:  CLP$137,173.40
You save:  CLP$39,195.20
CN¥722.95
List Price:  CN¥1,012.16
You save:  CN¥289.21
RD$5,921.50
List Price:  RD$8,290.34
You save:  RD$2,368.83
DA13,490.83
List Price:  DA18,887.70
You save:  DA5,396.87
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q779.86
List Price:  Q1,091.83
You save:  Q311.97
GY$20,923.51
List Price:  GY$29,293.76
You save:  GY$8,370.24
ISK kr13,946.60
List Price:  ISK kr19,525.80
You save:  ISK kr5,579.20
DH1,013.19
List Price:  DH1,418.51
You save:  DH405.32
L1,763.34
List Price:  L2,468.75
You save:  L705.40
ден5,702.11
List Price:  ден7,983.18
You save:  ден2,281.07
MOP$805.89
List Price:  MOP$1,128.28
You save:  MOP$322.39
N$1,893.44
List Price:  N$2,650.90
You save:  N$757.45
C$3,681.15
List Price:  C$5,153.75
You save:  C$1,472.60
रु13,335.63
List Price:  रु18,670.42
You save:  रु5,334.78
S/370.84
List Price:  S/519.19
You save:  S/148.35
K382.72
List Price:  K535.82
You save:  K153.10
SAR375
List Price:  SAR525.01
You save:  SAR150.01
ZK2,522.76
List Price:  ZK3,531.96
You save:  ZK1,009.20
L461.43
List Price:  L646.02
You save:  L184.59
Kč2,350.75
List Price:  Kč3,291.15
You save:  Kč940.39
Ft36,729.02
List Price:  Ft51,422.10
You save:  Ft14,693.08
SEK kr1,071.30
List Price:  SEK kr1,499.86
You save:  SEK kr428.56
ARS$85,766.82
List Price:  ARS$120,076.98
You save:  ARS$34,310.16
Bs691.04
List Price:  Bs967.48
You save:  Bs276.44
COP$387,583.68
List Price:  COP$542,632.66
You save:  COP$155,048.97
₡50,832.34
List Price:  ₡71,167.31
You save:  ₡20,334.97
L2,468.78
List Price:  L3,456.40
You save:  L987.61
₲737,805.73
List Price:  ₲1,032,957.54
You save:  ₲295,151.80
$U3,781.90
List Price:  $U5,294.82
You save:  $U1,512.91
zł400.73
List Price:  zł561.05
You save:  zł160.31
Already have an account? Log In

Transcript

Welcome back everyone. In the last video we went about shaping up our characters jumping script. In this one, we're going to be focusing on our characters landing script. Specifically, we'll be adding some quote unquote game fields to our characters landing via some particles, some sound and even a little controller rumble for those of you that are going to be playing with some attached controllers. So this work is once again going to be done within our BP player. So if in case you don't already have them open, this is the path of folders to find your BP player.

Double click under BP player to open it up. And once again, we are in our move set tab that we created our move set Event Graph here. And here is our jump script. It would probably be a good idea if we had our landing script down below. So firstly, We are going to start off with events. There is an event for on landed so we can right click in some empty space here and do a search for landed.

And there is that event on landed I was just talking about and we will bring this guy right on down here. Next thing we're going to do is I'm going to bring in a reference to my capsule component. Drag and drop this guy on in and we are going to get its world location. You'll see why here in just a moment. Because we're going to use this location for a play sound at location so I'm just right clicking in some empty space right here. I'm gonna say play sound at location.

Let's hook up our location of our capsule component To that, and for event on landed, which will fire out when our character lands. What sound do we want to play I do have one in mind, it is going to be called Countess underscore efforts underscore land. And there is a few options here for land again, this one has a duration of zero, this one has a duration of 1.1. So I would choose the 1.1. Let's see we can adjust some of the volume multipliers and all this I'm actually going to change the volume multiplier of this to half that 0.5 and that should be pretty good there. Let's give this a quick test.

So we're going to play, jump and there you have it. Little sound for when she lands so that's good. Let's keep going here let's add an emitter for when they land. Okay, drag a wire off of here we're going to do spawn emitter at location. The emitter that I have in mind for this is going to be called p underscore master grunt. Master grunt which one of these is drag dust.

That's the one I'm looking for. And if you're wondering where this one is located, you can highlight over it and this too is in the Infinity Blade effects. You don't have to use this one, feel free to use whichever one you want. Now of course, I need to feed in the location where this is going to play. So here to I'm going to bring in a reference to our jump VFX spawn point. We're going to use that guy because if you remember right, this jump VFX spawn point is right at our character's feet.

Jumping back to our move set right here. And I'm going to drag a wire off of it. And I'm going to say get world location. And then let's plug this guy in here. And with that little bit of script done, let's try once again now should hear a sound and see a and emitter spawn as well jump in, you see a little puff of smoke there. And that puff of smoke is pretty cool.

But what I would like to do is I would like to scale, the size of that puff of smoke depending on how high or what what type of distance our character traverses. When they fall, you know, we only want a small puff of smoke if they jump up a little bit inland, whereas if they're coming from a high elevation and landing, or jumping way up in the case of our double jump, which she'll eventually be able to do, I want that puff of smoke to be much, much bigger. So To help with that, we are going to be creating a brand new variable down here in our BP flare. So click this plus variable button. We're going to call this one jump scalar. And I'm going to change this to be a float variable type, we can change it right down here by left clicking on that little pill.

A float is a number with a decimal point. And if we compile this, I'm going to give this a really small number by default I'm going to go negative, rather negative point 001. Why this particular number? Well, because in putting together what I'm about to be putting together, this turned out to be the math that I was looking for and will actually expose this math to the screen in a little bit. Now to determine the size of this emitter that we're going to be spawning here. I'm going to be doing some fancy math.

So I am going to be bringing in our character movement component firstly. And the reason I'm going to be bringing that in is because I want to drag off of it and I want to get velocity. Get velocity way at the bottom here is this yellow one. Now, how did I even know that this existed here? Well, if you select your character movement component, and you do a search in your Details panel for velocity, velocity, you can see you've got some velocity parameters right there. That's how I knew I could bring this out of our character movement component because I knew that it existed within our character movement component.

Okay, next what I want to do is I want to right click on this velocity pin and I can do something called split the structure Pin, essentially, I'm going to find out what is going to be our velocity in the z direction. That is, when our character is falling down to the ground. I want to know what her velocity is. And then what I'm going to do with that is I am going to multiply that drag a wire out of this and click the multiply button. Or you could do a search for multiply there. And we are looking for float times float right there float times float.

And we're going to multiply this value by our jump scalar variable that we just created, like so. And now what I want to do firstly is I want to bring in a print string node. So I'm just going to right click and some empty space here, print string. And I'm going to hook this onto the end of our spawn emitter at location and then I'm going to take the result Have this and I'm going to plug it into our in string, a little conversion node will appear. And the reason I'm doing this is because I want to output this math to the screen so we can see what this number turns out to be. Now I'm expecting numbers between anywhere between like zero and three is kind of the range that I'm going for.

So let's Compile and Save this and give this a try. So now I want to jump look in the upper left hand corner of my viewport here and see when I land what that number is. So there we got 1.36 1.37 little jump here is a little bit smaller, a bit smaller still. Now I don't have double jump, we have not created that ability yet. So those numbers will get a lot bigger and they can get a little bit smaller if you know we do an even tinier jump, but you can see sort of the range that we got going on there. Now to ensure that it stays within the range numbers that I want.

What I'm going to do is drag off of this result right here, our velocity multiplied by our jump scalar. And I'm going to do a search for a clamp float node, I want to ensure that no matter what this math calculates out to be I want it to be between 0.5 or a max value of three. And the reason I am concerned with what this math results to be is because I want to drag off of our spawn emitter at location here, get this return value. This is going to output that emitter and I'm going to do a search for a node called set world scale 3d. This node can modify the size of this here particle. Okay, so I'm gonna leave our print string in there for now, I'm going to plug this into our set world scale 3d and it wants to know what what should this scale be well If I simply take our return value from our multiplication here that we're doing, and that we're clamping, we can plug that in is our new scale.

So essentially, the bigger this math turns out to be, and it will be bigger depending on if we're jumping from a higher location, the bigger our particle is going to be. And I think to help me demonstrate this a little bit, I am going to place our character on a temporary platform. Let's do something like that just to make it so that she can jump up here and then jump off of this to have an even higher number result for what the size of that particle should be. So here we go. So you can see I still am outputting those values to the screen. So that was a small one.

You can see the value right there when I jumped up on top of the block was quite small. Point three, two Now watch what the numbers spits out as when I land on the ground from this height, almost a value of two and you saw that that particle effect was a little bit bigger in size. So here we go. Definitely a bigger puff of smoke. So that's just a way to fine tune the size of our dust particle when we land. Now one more thing I want to do here before we wrap up our landing script here is I want to add a little force feedback that is controller rumble for when we land.

So the way we're going to do this is I'm going to firstly right click in some empty space, and I'm going to do a search for Get Player Controller. The controller is the thing that allows us to input or move around our character gives us control over our character. Then I'm going to drag a wire off of this and do a search for play dynamic. force feedback. So let's make sure that we wire this into the start. And it's going to ask us for an intensity and a duration.

Well, for a duration, let's set that to be relatively short like point one. And for the intensity for this guy, if we hover over it, it says a valid value is going to be between zero and one. Well, how about we use our output from all this math back here, we can drag this out. And let's do a float divided by float. And I'm gonna divide it by three. And that should give us a pretty good range in there.

So if you have a controller, you can test this out. Now if you don't have a controller, you don't need to worry about this playing dynamic force feedbacks, but I'm gonna try to Compile and Save here. I do have a controller handy. So I'm just going to do a quick test here. To play and I can feel that rumble in my controller. Obviously you can alter some of this stuff as you see fit, fiddle with some of the math there, fiddle with some of the clamp values etc that's going to be up to you guys you can spend a long time tweaking what you want your jump scaler to be what you want your clamp to be, if you want to divide this number, not even the duration here you can fiddle with as well.

Anyways guys, that is going to do it all for this one. Let's do one more thing, put a comment box around this by left clicking and dragging. We will call this our landing script, Compile and Save one more time. And that'll do it for this one guys. We will see you in the next one.

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.