Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this video I want to create a checkpoint system so we don't always spawn at the start location.
But let's say if we walk all the way here and we get defeated after that, we then want to spawn in
this location.
And this is something very essential.
And it's actually quite easy to do this.
Just go to the content drawer and blueprints, and we want to create a new folder first for new folder
and just called props.
For props for the level and stage.
And in here we want to create a new blueprint class of type actor, because it's just going to be a
very simple actor with a box collision.
And if we walk into the box collision, this is going to be our active checkpoint.
So create an actor and I'm going to call BP checkpoint.
Open this up.
And just for visualization I first want to add a cube.
This is not going to be the collision right.
This is just for visualization I want to make it small though.
So here on the scale on the Z just make it a 0.1.
So it's going to be a very small cube.
And this is just for visualization.
This is not going to have any effect on the actual collision that we're going to use.
What we want to use for this is to again select the default scene route and not the cube and look for.
Collision.
And we're going to use a box collision.
Right.
And this is going to be our trigger.
So we can just call it trigger to make it very clear.
And we want to make sure that it is the same size.
So we can use this box extend and just drag to make it around the same size as the platform.
And also here make it the same size.
And we can then make it a little bit higher because we don't want the player to be able to just jump
over the trigger and be able to skip a checkpoint.
Maybe in some games you would want to do this, but we don't want to do this for this game, so just
make it quite tall.
Around 200.
And we then want to drag this upward, because we don't want to have this extend in the floor of the
map.
And just like this.
So this is a very tall checkpoint.
They're not going to be able to jump over it.
And we just prevent issues like this.
And now for the collision settings.
We just want to go in here and drag down to collision collision preset.
And I want to set this to custom because we're not going to use this anywhere else.
We can just set this up in custom.
There's no need to make a preset in the project settings.
And here we just want to ignore everything except for the pawn.
And the pawn should overlap because we want to check if the player walks into this.
And then we simply want to scroll down and go to the on component begin overlap, which we've used a
couple of times throughout this course already.
And here, what do we do?
Well, other actors cast to be player like this.
And for now we just want to print string.
Right and say checkpoint.
And we go back to the map and we now just want to add a checkpoint somewhere here.
Right.
So I can just drag out the BP checkpoint.
And I want to make sure it is on -50.
Because that's the same as the player and as the crab, and we can just drag it over here a little bit
to be on the yellow.
And now I can go in here and I can defeat the crab.
I go here and I step on the checkpoint and you can say it says checkpoint.
It says checkpoint multiple times, though every time I enter it.
And a problem with this is if we have multiple checkpoints, we walk back.
We don't want an old checkpoint to be reactivated, so we actually want to make sure that we can only
activate a checkpoint a single time.
So here we can use a do once node, not the multi-input, just the do once.
And now you can see that if we compile and save I go here I do the same thing.
It's only going to happen one time.
I can't reactivate the same checkpoint again and again, and this is what we want to do.
And since the checkpoint system is a kind of overarching system that is dependent on our game's rules,
this is also something we want to implement in the GM action, the game mode.
So what can we do here?
We can have a variable for active checkpoint.
Like this and just turn this into a BP checkpoint.
And here we use a object reference.
Right.
And compile and save.
By default it is nothing.
Right.
So if I click here, um, the active checkpoint, it is none by default.
So this is fine.
Then in the BP checkpoint we can get a reference to the game mode like we did in the player before,
right.
So in the action char base actually I think.
Now just in the player.
So in the BP player on begin play.
Right.
We do this with the get game mode, cast to game action and set it right.
So the first two parts we can just copy control C, go into the checkpoint on Begin Play control V to
paste this in.
We just get the game mode and we cast it to the GM action here and here.
We also want to save this as GM action.
Like this.
And we can then again access this everywhere in our blueprint.
And what do we do here?
Well, on the overlap event, we don't just print checkpoint, but on completed.
Uh, after the do once.
Well, we want to get the GM action here and set active uh, checkpoint here.
Default set.
Active checkpoint.
And we just pass a reference of our selves.
So just self get a reference to self.
So yeah we're just going to talk to the GM action.
Tell it hey I am the active checkpoint.
Now please save me in here.
And just for now, for the sake of clarity in the BP checkpoint, after we do this, we can just get
the cube, which is just for visibility and just set material.
Uh, here and material element index zero because, yeah, we only have one material here and here.
Just select anything that looks different.
Right.
Um, maybe something green so we can just type in green.
Green.
And if there's nothing here, well you can just click here and show engine content, show plugin content
and just pick any random material.
It doesn't really matter.
This is just for testing now.
So we can compile and save.
And I go in here and touch the checkpoint and you can see it turns green.
And we also know that this worked now.
And in the GM action it now set the active checkpoint.
So now in the function where we respawn the player we need to decide if we have an active checkpoint.
We want to use the active checkpoint.
Otherwise we want to use the player start as the location.
So in here for respawn player, we can just open up some space and we can get active checkpoint.
And we can then drag off here and check for is valid and use the one with the question mark.
So here.
If it is not valid, well, we just execute what we are doing here at the bottom right like this.
And we use the player start.
But if we have an active checkpoint, we can just copy paste all of this.
Except for the player.
Start and put it in here.
And connect this up here.
Like this.
And just open up some more space.
And now here we just want to use the active checkpoint.
So copy paste this put this in here for the transform.
Right?
So if we have a valid active checkpoint, we use the valid active checkpoint.
And you might be wondering that this is maybe not the best way of doing it, because we are kind of
duplicating these nodes.
And one thing I tried doing is to just use a select here, right.
So we can just use a select here and use the active checkpoint is valid.
Uh, and you don't have to do this.
I just want to show you we can use this is valid and then decide here if we use the active checkpoint
or the player start.
But actually using an is valid check or an invalid thing here is not a good idea because for a select
it actually evaluates both options first.
So this is actually going to cause bugs and null errors.
And in this case this is not a good solution.
So I can just get rid of this.
And yeah we're just going to stick with our active checkpoint here.
And at the bottom we're going to stick with our player start.
It's a little bit verbose, but this is not going to cause any null errors.
Now let's just try this out.
So first I don't have a checkpoint.
I just get defeated.
And I start back at the beginning here.
So this is fine.
And now to test the checkpoint actually can't defeat the enemy because I need the enemy to attack me.
So we just skip over it, touch the checkpoint, and now we get defeated by the enemy.
And now I respawn at the checkpoint.
But as you can see, there is one problem.
We actually respawn in the middle of the checkpoint, but it is working.
We just got to adjust the position a little bit, and to do this we can go to the BP checkpoint and
to the viewport and we can on the default scene route, add a scene component.
And just like this, and we can drag it up a little bit to make sure that we spawn in the air.
We don't spawn in here because this is going to be the middle of our character, right?
This is not going to be the feet of our character here.
So this is, uh, some leeway we need to have here.
And it's a little bit hard to see this, right?
Because if we don't click it, we don't know where it is.
And just the thing you can do for this is to, on the scene, add a billboard.
A billboard.
And now the position isn't correct.
So we can just reset here on the location.
And now it's going to be in the same position as our scene, and now we can just see where we drag it.
This just makes it more visually appealing.
We're not going to use the billboard in any gameplay fashion.
This is just to make it easier for us to see where the scene is located.
And yeah, I just put it at about 135, but I think if it's higher than 100, it should be fine.
And now in the, uh, GM action, if we check for the active checkpoint and here for the Get Actor transform,
we actually want to get from the active checkpoint.
We want to get this seen.
So get seen.
Here, get the scene and we then want to get World Transform from this.
Here and split this up and use this instead.
And the rotation, not the scale.
And delete this.
Can use all of this here.
And just open up some space.
And yeah.
So this way we just used the scene component.
In the checkpoint to just make sure we spawn a little bit on top.
So let's try this out.
And actually we get an error here.
So let's check this out in the GM action.
Uh, yeah, it was just we didn't compile, so we just compile and save.
And now I skip the enemy.
I take the checkpoint, I get defeated by the enemy.
And now we nicely spawn above the checkpoint.
And this is a very common way of implementing checkpoints that you can use in all of your games.
And now that we're done testing this system, we can just go to the BP player and set our health back.
So in the BPC vitality, we can set our health back to ten, which should be our default value.
Don't forget this compound safe.
Make sure to save all.
And now we can just, uh, close all the tabs to the right.
And yeah, we are done with the response system.
In the next video, we're going to take care of respawning.
If we fall off the map, which is a different thing we need to implement separately.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.