‫Hello and welcome.
‫In this lecture, we're going to be polishing off this level.
‫We're going to get it to the point where we can drop the gargoyle statue.
‫We can go through into our new area and make it so that when we're in the mausoleum, we've got a gate
‫over there, we've got a statue here.
‫If we take the statue from its podium, the gate shuts and we can't get out in time.
‫And we need to find something else to put on the podium.
‫Let's dive in and see how we achieve all this so we attend to implementing this final puzzle in the
‫crypt.
‫So what we're going to do here is I'm going to place a podium in the center with a statue on it, and
‫I'm going to put a railing or a gate above that can come down if you take the statue off.
‫So if I look in medieval dungeon meshes and props, there is the hooded metal golden statue and the
‫statue stand, which I'm going to be using both.
‫So let's go ahead and bring the statue stand in.
‫First, we can go into the full by four view to make sure I am positioning it roughly in the center
‫that I'll do.
‫And then let's bring in the hooded metal statue, you'll notice.
‫Absolutely teeny tiny goodness me, that's absolutely minuscule.
‫So what we're going to have to do is we're going to have to increase its scale.
‫I'm just going to hit the lock button next the scale to make it all go together.
‫Let's try ten times bigger.
‫That's a bit large.
‫Maybe about six times bigger is good for this statue.
‫And let's place him on the statue's pedestal and rotate him around.
‫Now you'll notice the scene keeps going dark.
‫Now, this is because of the exposure compensation method that's being used in the scene.
‫To change that, we need to go to our add actor quickly.
‫Add basically go to volumes and we're going to look for.
‫The post processing volume.
‫I'm going to put that in the scene, right click on it, and I'm going to move it to the global folder
‫and then selecting the actor.
‫We're going to go into the details pane, going to go to the exposure setting and we're going to check
‫metering mode here and change the metering mode from auto exposure histogram to auto exposure basic.
‫And you can see this volume is actually quite a small block.
‫What we can do is we can increase the size of this volume so that it applies to the whole area.
‫So let's reposition it.
‫Scroll down to the brush settings at the bottom where there is the X, Y and Z sizes.
‫We can increase these and be a little bit generous.
‫So we just want to include everywhere our player can go in our level like so.
‫And now you can see the lighting is instantly getting better and we are not having this problem where
‫if we're looking away from a light, everything gets really, really dark.
‫So let's open up the content draw again because I want to bring in something from the architecture folder
‫in the dungeon.
‫I want the cell side mesh.
‫So let's bring that in to our level to try and position that near the door.
‫And I'm just going to take note of how high up it needs to be for it to be out of the way.
‫So at the moment, the Z position is -440, and if I position it at zero zero, that is out of the way.
‫So what I'm going to do is I'm going to position it down on the floor and I'm going to add a mover component
‫and its offset should be positive for 14 because if you think about it, the statue is in the trigger
‫zone or will be.
‫And when it's in the trigger zone, we want it to lift up by 440.
‫When we remove the statue, it's going to go down by 4 to 40 and lock off the area.
‫So the statue needs some collision properties setting up.
‫So we'll go to down to the collision presets.
‫We're going to go to custom and we want the grabber to block this particular object because we want
‫to be able to grab hold of it.
‫And if we go down to the pawn, we want the pawn to be ignored by this particular object so that we
‫don't collide with it.
‫And we're going to need it to generate overlap events as well because we need it to overlap with our
‫trigger.
‫Talking of trigger, we don't have that yet.
‫So let's select our statue stand and let's add to that a trigger component like so.
‫And then let's reposition that trigger so that it encompasses the statue and then let's add an acceptable
‫tag which is going to be unlock two for me and let's select the statue will go to its actor section
‫and add a tag which is going to have to match as unlock to let's maximize this viewport.
‫And now what we need to do is make that link between the trigger and the mover.
‫And we're going to do this in the level blueprint because we've set this up in the level.
‫These actors aren't connected to each other in any other way.
‫So we're going to go to the blueprint button, go open level blueprint, and then making sure we've
‫got our statue stand selected.
‫We're going to go pull off of Begin Play or rather we're going to click in the scene and add a create
‫reference to the statue.
‫Stand from this.
‫We need to get that trigger component.
‫So we're going to do a get component by class.
‫And we're going to select the class to be the trigger component.
‫So we've got a trigger component class here.
‫Then the other part of the puzzle is to go and select our.
‫Sell actor and having that selected, we're going to go into the dungeon level.
‫We're going to right click and create a reference to the cell actor.
‫And then using that cell, we're going to again get component by class.
‫The class that we're looking for this time is the mover.
‫And then pulling off of our return value from the trigger component, we can call set mover and connect
‫up the mover pin and connect up the execution pin to begin play.
‫And the other thing we have to do is select the cell and we need to make it movable.
‫So if we go to general, we can select movable in there.
‫We probably need to do the same with our hooded statue that needs to be movable.
‫It already is.
‫Let's go ahead and hit play and you can see that the cell side has moved out of the way, has reached
‫up to the ceiling because our statue is in the trigger component.
‫But I can't pick the statue up.
‫And the reason for that is that it's currently being held onto by the trigger component and it's being
‫set to not simulate physics.
‫So we need to add that into our grabber.
‫CP So let's challenge you to activate this statue so that it is ready to move out of that trigger component.
‫To do that, you're going to need to set simulate physics on the hit component, you're going to set
‫it simulate physics to true.
‫You're also going to have to detach the actor.
‫So detach actor, detach from actor.
‫And you can see that just like we had attachment transform roles, we've got detachment transform roles
‫as well.
‫And for this one as well, we're going to be using Keep World Transform.
‫And then as a bonus, once you take that statue out of the trigger component, you're going to notice
‫that the gate doesn't automatically rise because we've currently got our mover working in only one direction.
‫So as a bonus, make it work both ways.
‫If you put something into the trigger volume, it moves to the goal and if you take it out, then it
‫moves back to start.
‫So pause a video and have a go.
‫Okay.
‫Welcome back.
‫So first of all, in the grab CP where we are grabbing things, we have got this way called rigid bodies
‫from the hit component.
‫Let's take that hit component and we're going to set simulate physics to true.
‫And then we've got this getting the actor here.
‫I'm going to put that into its own variable.
‫So a actor, star hit actor is equal to hit result get actor and then we can replace that.
‫So hit actor tags.
‫And then further down we're going to detach that actor as well.
‫So hit actor arrow detach from actor and then we're going to do an F detachment, transform rules,
‫colon, colon, keep world, transform a semicolon at the end of the line and let's recompile and see
‫if that works.
‫Let's go ahead and hit play and try and pick up our statue.
‫And this time it comes away just perfectly.
‫However, our gate doesn't close as it should do.
‫So how are we going to go ahead and make our gate close?
‫Let's see if we can put the statue back on the stand.
‫So let's stick it over here and there you go.
‫It stays there by itself because it gets automatically attached to the trigger component.
‫So for the move, a component of the challenge, the bonus, if we go and open up the mover, which
‫you can do with control P by the way, and search for mover and we can open up the move of CP, then
‫we can go down to where it's got if should move.
‫And you can see that essentially we want an alt statement here that sets the target location just to
‫the original location in in the alternative case.
‫And basically the rest of the code needs to run all the time to move to the location.
‫So let's take it all out of our if statement like so and fix up any indentation issues.
‫And essentially what we want is the target location.
‫We're going to set it to a default value before the if statement.
‫So the default value is going to be the original location.
‫I'm going to just cut out that move offset.
‫So what we've got is we set up a target location with the original location.
‫So by default, it's going to want to move back to its original location.
‫But if should move is true, then we need to update the target location to be equal to essentially the
‫original location plus the move offset.
‫So that takes us to essentially our goal location.
‫So then later on we can calculate the current location.
‫We do the distance and the speed calculation.
‫We do the V interpret constant to and we set the new active location.
‫And one more thing we need to do is change the way we calculate the speed, because here we are looking
‫for the difference between the original location and the target location, which when we set the target
‫location equal to the original location is going to be zero.
‫And so our speed is going to be zero.
‫So instead, well, we know the difference between the target location in an original location is actually
‫the length of the move offset.
‫So what we can do, instead of calculating the distance this way, which is always a bit wasteful,
‫is we can do a move offset dot length and divide that through by the move time.
‫So that's a need some parenthesis because it's a function move offset dot length parentheses divided
‫by the move time.
‫Let's recompile and try that out.
‫Go ahead and hit play, pick up our statue and you can see the gate goes to close.
‫I didn't quite let it open, so maybe we didn't see that it goes the whole way.
‫But if I drop the statue in its place, it lifts all the way up to the top.
‫Take the statue off and it goes all the way back down to the bottom.
‫Great stuff.
‫So now all that remains for me to do is add a little plot or something that we can take for the puzzle.
‫So I'm going to go into the meshes under the props and I find a little complete pot and put it by this
‫other door on the other side.
‫So there's a little bit of a challenge trying to find something we can put in the statue's place.
‫I'm going to set it to generate overlap events just like the statue, the collision presets we need
‫to set to custom.
‫We're going to change that so that the grabber can grab it, so put it to block and that it doesn't
‫overlap the pawn.
‫And we're going to go to the actor tags, add a tag for unlock two.
‫And then the final thing we need to go and do is set it to move a ball.
‫Let's go ahead and hit play and see if we can grab this pot.
‫Yep.
‫Looks like we can.
‫Let's go and take it through into this mausoleum area.
‫We can take off the statue, take our pot and stick it in its place.
‫And you can see that it opens up and we can take the statue and make a run for it.
‫At stake.
‫So in this lecture, we've tidied up the rest of our level and completed the game that involved making
‫a few code changes, including making the mover move back and allowing the grabber to detach things
‫that it picks up and set them to simulate physics.
‫Great stuff.
‫I'll see you in the next lecture.