Welcome back everyone in this series of videos we get to make our stuff come to life, we are going to get onto some blueprints, scripting, and adding some functionality to all the blueprints that we constructed earlier. We're going to start off with our BP moving platform. So go ahead and find it within this series of folders, double click on Open it up. And first let's talk about what we are trying to do. Well, we want a moving platform that starts in one location and ends in another location and just kind of goes back and forth between a start location and an end location. Now you saw me do something like that when I did our health pickup, and you could create a moving platform in a similar fashion using a technique similar to how we're getting our health pickup to Bob up and down but we're gonna do a little bit different technique for this one.
I'm going to ask you to do now is to come down to the My blueprints section down here and add a couple of variables. Let's start off with just one. And we're going to call this one start locale. And this is going to define our starting location for our platform. Now off to the left here, you see this little pill shape that is colored red. This indicates what type of variable This is.
Red indicates a boolean variable which holds true and false information. We don't want that type of data for this one, we want this to be a vector variable. A vector variable holds X, Y and Z data. In our case, that is going to be x, y and z locational data. All right, so let's over in the right hand side, you see that it says we must compile this blueprint. So let's go ahead and compile and then you can add a default value for the starting location.
I am fine with 000 For now. Okay, so we've got a starting location variable, how about we right click on this guy duplicated. And this one will be end locale. Obviously, we want this to be a vector variable as well, because we want to specify an X, Y, Z coordinates Where is going to be the end location for this moving platform. Once again, let's Compile and we're going to get a little bit of a warning here because this is the exact same values as our start. So let's just set our z to be 500.
And now if you are to Compile and Save all as well with the world when you see that green checkmark, a couple other things I do want to set on this end locale. Over in the Details panel, there is a field called instance, editable when you check this and go ahead and check it. You're going to notice that this little eyeball icon shows up down in the My Blueprint panel as well. So if I was to click this off, you're going to see that that instance editable field unchecked as well. So there's kind of two ways to make this instance editable. What does that mean?
Well check this out. If I was to drag in Let me compile this first must compile. If I was to drag in my moving platform, and look in the Details panel, I can see that right here in the level editor, I can punch in what I want my end locale location to be. This basically exposes this variable right here in the level editor. However, if I was to uncheck this, make it not instance editable. Let's go ahead and compile now.
I no longer see that in the Details panel. This is some customization that we Do want so let's go ahead and check this on. One more thing I want to check over in the Details panel for our end locale is this show 3d widget. If we click this on, and then I compile once again, make sure you compile, jump back into your level. We have just added this sort of purplish triangle right here. This currently is specifying where our moving platforms and locale would be.
So this isn't functional just yet. We haven't done any scripting just yet. But right now we are saying our start location is right here. Where it is on the ground in our end location is right here. Why this is awesome, is with this blueprint. You can actually drag this around that purple icon and you can see how it is updating the end locale is well.
What makes this super sweet is not only does it make it easy to customize where We want the end location to be. But if I was to add a another moving platform and select it, I can make it so that this one has a different ending locale. So maybe that ending locale for this instance is up here. For this one, it's down here. That is some sweet customization that we do want. Okay, let's move on to the scripting aspect then.
So I'm gonna jump back into our BP moving platform here. And in the Event Graph is where we want to add the script to make this platform move up and down. Now, there's gonna be some events in here to get you started here, we don't actually need any of these. So just for clarity sake, I'm going to left click, drag on a marquee selection to highlight all those and I'm going to hit that delete key to delete those out. So what do we want to do here, we want this platform to be moving up and down. So we need to talk to our platform component.
What you can do here left click and drag directly from this components panel here, a reference to your platform into your Event Graph. Now, what do we want to do, let's drag a wire off of our platform here so we can talk to it. And off of this, we're going to be looking for a node called set relative location. So what this function note is going to do for us is it's going to set the location of this platform relative to where it is at in the level currently, okay, that it needs a new location to go to and we're going to be working on that here in just a moment. Next, I'm going to be bringing in a reference to our start locale down here. We can drag and drop this into our level and when we do it says Do you want to get it or set it we want to get our initial location.
And we also want to do this with our end locale so you can left click drag and drop a reference to the That. And again here we want to get the value stored in that variable. Okay, next thing is you can drag a wire off of our start locale here. And we're going to look for a node called lookup vector. Now lurk is short for linear interpolate, and we're going to plug our end locale here into this B. And then I'm going to plug the return value of this into our new location.
So let me explain sort of what we got going here. To learn Think of it as to go from one thing to another to go from point A to point B. That's what this learning node is going to do for us. It is going to go from point A to point a or start locale to point B, our end locale. But how do we determine how do we go from point A to point B? Well, we need one other input known as an L To go in here.
Long story short, what I'm aiming to do here is over X amount of seconds, and I'm thinking maybe eight to 10 seconds, I want to go from point A to point B, then back to point a again and just kind of loop that back and forth. So we need to change the value of this alpha to go between A and B. When alpha when this alpha value is zero, we are going to be calling upon our a location, the start location. When this alpha value is one, we will be at our B location. So think of the alpha value of zero as being at the a location, an alpha value of one being at the B location. And if you are at say, 0.5 alpha, you are halfway in between there.
This is a little confusing yet. Let's just get on with our next step. And hopefully it'll make some more sense. So So we need to change the value of this alpha over time. And the node to do that is something called a timeline node. So I'm going to right click here in our graph.
And I'm going to search for a timeline node. Right down here, add timeline, and it's going to ask for a name right away. Let's just call it movements. And this is a special type of node because you can actually double click on this node to edit a timeline. I'll do that here in just a moment. If you double click on any of these other nodes, nothing happens.
But with a timeline here, if you double click on it, you'll bring up this whole new tab along the top. So what you hear what you see here is a timeline editor. And what we want to do is we want to add something called a float track and that's this f plus symbol along the top. So go ahead and click that. What this is going to allow us to do next is ask us for name for what We want to change over time, and I'm going to say alpha. And you can see that after I've done this by jump back to my Event Graph, I've added a new output to our movement timeline here known as alpha.
This is eventually going to plug into right here. So I'm just gonna do that straight away. Note that this is a float value, and this is a float value, hence why I chose to add a float track. Okay, so how long do we want this movement cycle to be? I'm gonna go something like 10 seconds. So what I'm gonna do here is specify along the top where it says length, instead of five.
I'm gonna go 10. And that white portion of the timeline here indicates 10 seconds. Next, I need to define what are known as some keyframes along this float track. And to add a keyframe, you can either right click and say add keyframe, or you can hold down the shift key and left click, I need to add three of these. And this will make sense when I get all these in here in just a moment. Okay, for each of these dots on our timeline here, we can add a time value and then a value value.
So for this first one, I'm going to select it and you'll know you have it selected when it's yellow, I'm going to change the time to be zero and the value to be zero as well. Then for our second key here, I'm going to set the time to be halfway to be towards the end, which is 10 seconds. I'm going to change that to five and I'm going to change the value to one. And then I'm going to select our last key here and I'm going to set the time to be 10 seconds and the value to be zero. Now we've got a timeline that looks something like this. And if you click these buttons right here, you can zoom to fit that into your frame all at the same time.
Let's do horizontal Well, it's going to zoom to fit them all in if you have all of them highlighted, so I'm just going to drag out a marquee selection to make sure I've got them all highlighted. And now if I click those zoom to fit, you can see that it fits very nicely in my timeline. With all those selected, I'm also going to right click here on any of them. And I'm going to set this key interpolation to be auto and it's going to create the sort of smooth sort of slope. Okay, so now let's back this up. What have we just done here?
Well over the course of 10 seconds, we are going to go from a value of zero at the very beginning of our 10 seconds up to a value of one at the five second mark and then gradually back down to a value of zero at the 10 second mark. And then I want to keep looping this so it starts back over here again, then goes like that, and then back again. So if I click this loop right here, it'll do this, the value of our alpha will go from zero to one to zero, then we'll loop back here, back up to one, etc. Okay, so what we are doing here is over the course of 10 seconds in our timeline, we're going to be changing the value of our alpha, again is going to be going from zero, which will call upon value a here our start locale and then it will go to a value of one five seconds in a value of one for alpha equals the B value, which is our n locale, and then back to zero again.
So essentially, this is driving which one of these we are picking as our new location for our platform. So none of this is going to work just yet because I don't have our update output here plugged into our set relative location. When we plug this update from here to here, we are basically saying pick a new location as this continually updates. Now we need some event node to trigger this timeline do we not Well, again, the timeline is a special node in that this one does not need an event in order to initiate it. If I go back into my movement timeline here, once again There is a checkbox right along the top that says autoplay, which will initiate this timeline right away without an event. So make sure you got autoplay checked here as well as loop.
And then that should be it. This should be our moving platform script, I'm just going to left click and drag out a marquee selection, tap the C key to leave a comment, and I'm going to call this moving platform. So with that, with that, let's go ahead and Compile and Save. And then let's jump back into our editor and see what we've got. So we've got these two platforms. Again, this one's got the end location right here.
This one's got the and location a little bit higher. In fact, let me set that end location even higher still, right? And it doesn't have to be straight up above. I can set it to be over here, right? So then it would start from here and go up here and kind of do this diagonal pattern. So you can Make this platform move up and down, diagonally side side, you name it.
So let me just jump in and play see what we got. You can see we've got one platform going down the other kind of going up at an angle right there. That is pretty cool. So we've got our scripting in place for our moving platform pretty sweet. So at this point, with that moving platform, all done the script as well as all the components in place, you can start looking to replace all of your placeholder platforms over this dark river as well as places like this. Remove any of your placeholders and put in your moving platforms.
Guys, that is going to do it all for this one. Hope you learned a lot. We will see you in the next video.