How to Make a Simple Respawn System in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to new Unreal Engine 5 tutorial and today I'm going to show you on how to make a very simple respawn system it's going to be a very easy video to follow so let's get started but first check out the link in the description to get out with some unreal ending courses on winfox alright so the first thing that we're going to do is um go ahead and set up the code so that it creates a new player and we actually can respawn each time that we die so for this we'll be knitting our current game mode so we can see that we have the um uh current game mode over here so we can just go ahead and search it and open it up in my case I'm just using the default uh third person gamer so we're gonna go ahead and open the full blueprint editor so we have more control over it and the first thing that we have to do is create a new custom launch which is going to be just respawn layer so we'll call this whenever you know we want to uh respawn the player it's going to make the p in capital here we go so each time we'll call this what we're going to do is uh spawn a new actor of a new class this time it's gonna be our third person blueprint of course you are using a first person blueprint it will go basically your character that you're using so the spawn transform what we'll do is set up later so for now we're not gonna worry on that uh we'll set up later but now we need to basically process this um character be able to control it because if not it will disappear but we will not be able to control the player so we're gonna go ahead and get the player controller so now we can call the um possess event and then what we can do is just plug in the return value into the in Pawn so now every time we'll call this upgrade now you'll see that we have a problem here with the spawn transform so I'm just going to split it so it doesn't give me another for now but this will basically spawn the billion.000 which is not what we want but we'll set it in a second so now what we're going to do is go into our player blueprint in my case it's the third person character and I'm gonna go down over here and I'm going to create a new custom events which is going to be depth now for now I'm gonna make it that if I press a key I would die basically set my my health to zero but I do have a really nice health system tutorial so if you want to check it out I will be leaving it in the description okay so now what we need to do is in depth I'm going to do is just simple and just destroy this actor basically destroy the player so now what we can do is call the events destroyed um event so basically this will trigger whenever an actor is being destroyed so now what we can do is basically cast to our game mode so in my case will be third person game mode and the object will be get game mode and now from it what we can do is just call um basically uh the events that we created before which is just respawn later okay so we can basically test this out now I just need to call death so basically you will call that you know whenever of course your um you have your health system and you set the the L to zero button on here I'm just gonna make it if I press a key so I don't really care what key is it for example let's say uh the E key and then I'm just go okay so let's compound save so now if I were to basically Press Play I can go into a certain position and if I press E I will be dying and you can see that new player is respawning um on the zero zero zero which is basically in this point over here because we haven't set it a new Transformer so what we're going to do is go ahead into the third person game mode and now we have some options here so first of all right click and recombine it so it's back into a transform and we have two options we can basically have a variable created on the game mode itself basically here and then change it or what we can do is basically um have it so that in the in the custom event when we call it we set up a new transform position in my case uh we're going to do is call it from uh when we call it from the inbox so we can just drag it into the event and it will be carried as an input so now in the third person character you will see that we have a transform position to be applied so I now gonna create a new variable here it's going to be the respawn point point and then we're going to do is set this as a transform and then you can see this I over here we're going to make it instance edible this will mean that we can basically change its value from the inspector later on but yeah what we're going to do just set it over here and now the thing is that we cannot set it really from the inspector from the details panel because our player spawns um with a you know player start so we cannot really do that so what we can do is go ahead and create a new blueprint class which is going to be an actor this is going to be BP spawn boss this will go ahead and open it up and we're going to do is just drag over here and just I'm gonna have a billboard this will mean that we can see it as a 3D icon on the scene so it will not have anything more so now we can just drag in our spawn position over here so the player will basically spawn in here and then we can go ahead and go into the third person character and instead of hand this variable we can delete it um and in here what we can do is before we go ahead and call the game mode we're gonna go ahead and cast to our BB spawn pass but before we're going to say get all actors of class and then I'm gonna say here BP pound pause and then we'll get a list of arrays so we can just get a copy because we are sorry we are only gonna get one of it so the element zero and I'm gonna cast for it and then what we can do is get its actor transform and just plug it in over here I know this was the last part was a bit you know more complicated and also in here not that we kind of I mean we can but we can use directly get the actual transform from the copy itself we don't have to cast it so now what we can do is basically we can you know move this actor around and the player when it dies will basically respond into that position as you can see now I'm gonna make a very last thing just make it look a bit better I'm gonna go back into our game modes and right before we do anything when we respond the player we're gonna add a simple delay of around 1.2 seconds so it will be in a nicer transition is not will not be like instant of course I recommend adding like a fading or like a UI display which is saying respawning things like that but I will not be coming in this video but I do have tutorials on that so if you want to check it out go ahead now another thing I have to do is basically uh right when we respawn I'm gonna say play sound uh 2D so we'll be playing uh like a respawn sound over here I do like this one so I'll go ahead and play it and I higher volume so you can guys appreciate it and also gonna go ahead and move the um spam pause over here up in here and then so it's a bit in a different position so it is easier to understand so if I now go ahead and press play I can now go ahead and play around but if when I press e that player will go and then I'll respawn with a nice sound so yeah guys that was the tutorial if you found it helpful I really appreciate if you like the video and subscribe to my channel I have lots of Unreal Engine 5 videos as this one so um yeah I'll go ahead and see you guys uh check out the link in description so awesome um courses on real engine and now yes people have said subscribe and bye foreign [Music]
Info
Channel: Gorka Games
Views: 27,108
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5, respawn system, tutorial, quixel, megascans, unreal engine respawn system, respawn unreal engine 5, ue5 respawn system, ue5 respawn tutorial, ue5 how to respawn, unreal engine 5 respawn player, unreal engine 5 respawn player system, unreal engine 5 respawning, unreal engine 5 how to respawn the player, unreal engine 4, ue4, unreal engine 5 respawning player tutorial, ue5 checkpoint tutorial, respawn system in ue5
Id: rHli1ov4ovo
Channel Id: undefined
Length: 8min 42sec (522 seconds)
Published: Wed Nov 23 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.