How to Make a Puzzle: Collect Items to Open Gate 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 today I am going to show you on how to create a simple puzzle where you have to collect all the items and the gate will open it's gonna be a very easy view to follow so let's get started alright so the first thing I'm going to do is the gate blueprint itself so let's go ahead and go into the content browser just right click create a new blooping class in this case it will be an actor that's going to place it in a world let's call this on a nice BP underscore fossil gate and with a couple of G will be nice and let's go ahead and open this blueprint up so it would be nice if you included the started content because we will have access to specific border for our door if I go to here again just get the door frame and just put it over there and apart from the door frame itself I can get the door which I go ahead and select over here mode a bit to the left as you can see we have this nice meshes which looks very cool I'm gonna be disable the snapping so I can precisely just put it more to the left I think this will be good just enable it back again if you don't have the starter content it's okay you could just go into add feature or can't attack counted and imported but of course if you want to use your own assets like a door or whatever you want go ahead and do so okay so now let's go ahead I need to make a simple event that will open up this door so let's go into the van graph delete all of this create a new custom events and this will just be open door door gate whatever you want to call it okay so for this we are gonna go ahead and create a timeline because it will allow us to change the rotation over time so let's call this Open Door NM and now we can double click to open this and add a flow track in this case we can just put whatever name we want like door rotation the thing that we're going to change and then we can put a specific lamp for me I think 0.7 will work or maybe even one so depending on what speed you want to open up the door just right click at any point add a key the first point will be at zero and zero so when a time is zero value zero and the second key which you can just click any point it will be at the end so in our case we'll be at one second because that's the length and value will be one because it will go from zero to one so it will be completed okay so now we have this output over here so we can just do a LARP and just drag with Ctrl from a to Alpha so it will go from this value to this one so now I can just get my door is go ahead and set the relative rotation it's very important that it's relative because it's going to do it in the local space of this blueprint and it's right click split it and then we can just plug in our new set rotation because all the other stuff will stay as default okay so now we need to figure out what rotations we want in this case it will go from 0 into the X6 to maybe around you know 90 or even 120 I think 120 will work so let's go ahead and use two and 120. okay so with that said now if I were to use you know to show you guys this I can use in the beginning play make a small delay of it's two seconds and then call open door so you can see that now it will indeed open up our doors so if I drag it into World Press Play wait two seconds and it should go ahead and open with the nice animations you can see and I can go through and everything is looks fine great so now what I have to do is go ahead and first of all just make this a bit bigger so let me just put in 1.3 maybe or even 1.5 I think that would be cool as you know resembling a big gate or maybe that's too big maybe 1.25 will work and now we just have to create the individual items that will pick up and we collect all of them is go to the door and it should open up so let's go back here and install the beginning played as I was just showcasing our animation and we can just right click create a new blueprint glass and this time will be another actor same as BB underscore puzzle item and let's open this up okay so now in here what I'm going to do is add a simple static mesh which will be our item mesh in this case I don't really have an item mesh so we can really put whatever we want uh so you know if you want you can choose a specific model but in my case I'm going to put this in real material you know thing so I'm gonna make it smaller so maybe like 0.2 and Please assign a uh not okay it's okay uh but that should be good we can leave our collision with no collision and then we can go ahead and add a collision over here which will be for example I guess we just put a sphere so this will be our trigger okay so when our player enters the install we can pick up our item so we make this bigger so maybe like around 100 when our player enters in the begin overlap we're gonna check if the other actor is we need our player so we can lose cast to it so use cast to Rotary character blueprint you're using and then if it goes then continue that means that it is our player indeed it has entering this trigger so we can just go ahead and destroy this actor because we want to you know beat up and then before we destroy it we will have to go ahead and here add some value into our puzzle gate so we can open this up so for that what I am going to do is go to the possible gate right click create a new custom event and in this case this will be uh collect python okay so let's compile go here and just collect item and of course of course we do have to get the puzzle gate so a way to do this just get actor of class so we can use find in our level our gate and then from there just go ahead and collect item now I do have to mention that if you were to have more than one gates in our level this will always pick the first one that it finds so you will need to somehow reference that specific one you want to open this can be done with a variable or whatever you prefer but in this case I'm going to do a simple just get the first one that I see in the level because I will only use one okay but I just wanted to let you know that okay so with that said let's go back to our puzzle gate and let's create a new variable which will be current items collected and of course this will be an integer and as it will just be a whole number and I'll go ahead and duplicate this and this will be the max items like all right so let's go ahead and use compile and just make this two values public so we can see them from outside and it's put in the max items collectible let's put around maybe we have to pick up five okay it doesn't really matter whatever number you choose but um you know what you prefer okay so for now what I'm going to do is get the current items collected and use this nice method which is the plus plus so it will automatically add one and assign it and I'm gonna check if this number now that it has incremented is bigger or equal than the max amount of items that are collectible so I want to go ahead and open up the door so I can just go ahead and go open door and with this I am going to make sure to only do this once so just add a two ones no because I don't want the door to bug out so do once there we go so only happen once great so with that said this in theory should go and work so now if I go and drag in my possible items in our floor so we need five okay now I can press play as you can see when I pass it disappears and I'm basically collecting them and adding them into the door you can see it went ahead and opened but it will be cooler if we had to go to the door and press e to open up with all the items collected right so let's go and change this a bit so instead of what we can do is just right click create a new custom event and this will be open door check and on here is where we are actually gonna do the check so instead of doing it when we add the item it will only be when we want to open the door so in this case now when we collect the items it will not automatically open the door we have the necessary ones it will only happen when we call this which will happen when our player is inside so for this let's go ahead and just add a new collider in this case a box collab will do this will be our trigger and then I can just go ahead make this bigger but instead of from just the normal scale it's better to do with the Box extent so let's just go ahead and just fill this up it doesn't have to be exact acting like this should do the trick and now with that said what I can go ahead and do compile is just go back to the third person guide to blueprint or whatever character blueprint you're using and then when we press the E key or whatever you prefer I'm going to make a for each Loop so I am going to be getting all the overlapping actors so the actors that uh my player is right now on and this will be you know true because I have this trigger that I will be on so my cat will be overlapping so it should pop up here we can leave the clasp in so if so I can just go ahead and use cast to the puzzle gate and with that if it's the puzzle gate I can just go ahead and check open door so with that said now I can just press play and you'll see how I can go ahead collect all of my items well I guess so and then go into my door you can see that uh I can trespass the wearable articulation in a second but when I press e it will open up but if I were to press E before collecting the necessary items if I only for example connect collect just two or even three you can see that now it will not open the door so you can put a special message message or whatever you want now quickly let's go into the door itself double click on the static mesh box Collision over here so at least we cannot you know go through the door and that should be it so that's it for this video you found helpful oh really if you like the video and subscribe to my channel so check them out the profiles will be available in my patreon and YouTube members so check them out join my subscriber follow me on socials now yes before I said bye bye [Music]
Info
Channel: Gorka Games
Views: 18,715
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 puzzle, tutorial, quixel, megascans, unreal engine puzzle open gate tutorial ue5, ue5 puzzle tutorial, ue5 puzzle collect items tutorial, how to make a puzzle unreal, unreal engine 5 how to make puzzles, create puzzle ue5
Id: Im4lJRNCVZA
Channel Id: undefined
Length: 11min 8sec (668 seconds)
Published: Tue Sep 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.