How to Make a Danger Zone in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to New real Engine 5 tutorial today I am going to show you how to make a dangerous zone so when you enter on a certain area with enemies or whatever you want to have it will display a quick message at the top and then when you exit it will fade it away it's going to be a very easy view to follow so let's get started all right so the first thing that we will need to do is the area itself so for this we'll create a new blueprint so let's go to the cont browser right click go to the blueprint class and create a new actor let's name this something as bpor danger zone and let's open this blueprint up so the first thing that we will need is to add a new component which will be a box Collision okay and this will be the trigger itself so we can name this something as trigger area and that's it the only thing that we need to make sure for this trigger is that it has the Collision preset set as overlap old Dynamics so our player can go through it but it can detect it so let's go go and subscribe to one of its events in this case we are interested on the UN component begin of our lap so let's go ahead and subscribe to this which is basically when our player will enter on this trigger so other actor will be the actor entering into this trigger so what we need to do is use cast to the first person character blueprint or whatever character blueprint you're using in order to check if the player is the one entering now normally we can also use a hashtag node and so on but thing is that later on we will need to reference this blueprint uh so that's what we need to do okay then what we need to do is go ahead and just um go and print for example entering danger zone okay and then on the uh end overlap so let's also subscribe to this which is when the you know player exits we will copy and paste those two nodes make sure to connect the other actor to object and then this will be exiting instead and now if we go ahead and test this the first thing we need to do of course is drag danger zone to our level and change the scale with a luck to maybe 20 as you can see it will be you know filling in this area we can also just go to trigger area and search for hidden in game and disable that and that way we can also see the trigger box itself when we play the game so if I press play you can see that it is here and if I go into it we can see entering Danger zound at the top and if I exit exiting in your zone so everything is going ahead and working correctly the only thing we need to do now is of course make sure that this will only trigger once as you saw we were printing three messages so we can do this easily but do when I do once note there we go and then we can also go ahead and do the same over here a do On's note great so with that said we can go ahead and make sure that it will only print one time because well it only detected the player once there we go there we go it makes sense now of course we will also need a reset but we can do that uh reset a bit later maybe just waiting like for example2 seconds something like that so you know we will leave a bit of time for our player to go through and with that said we're good to go let's now go ahead and create the widget itself that will display so let's go to the cter browser right click go to the user interface and create a widget blueprint which will be a normal user widget let's name this something as wbore danger zone and let's open this up so the first thing that we will need to add is a canvas panel to our Hier key that way we can start to add things into our screen then let's get text just drag it into our canvas and let's change the anchor so in this case going to put it at the top um Center let's put the position X and Y at the z0 and then we can add some alignment like 0 five so it be exactly at the center as you can see then I can just go ahead and increase the size X and Y just make it way bigger and then I can just change the text to be something as entering danger zone and then I'm going to change the justification to be the center and change the you know size to be a bit bigger and I'm going to put the X a bit bigger and drop the Y around here and there we go now we have this nice little text over here so what I need to do now is create two different animations one which will fade in and another one that will fade out when we exit that area so let's go ahead and just go to window and add this animations panel which you can see over here so let's select our text component add a new animation and this will be something as show message let's select this new animation that we have just created and for the first Alpha okay we will set it to zero so just expand color and opacity set the alpha to zero and add a key frame at the 0 of our timeline then we can advance a bit maybe to 1.25 and put our Alpha all the way to one and add a key frame and now if I press play you can see entering then your Zone will slowly appear which looks very very cool then the only thing we need to do is just create another animation which will be something as hide message go and select this new animation that we have just created go ahead and just uh select the um textt add it okay and then go and put the Alpha from one okay with the alpha to 1.25 with the alpha back to Z add another key frame and now boom it will hide that message which is pretty cool so make sure that by default the um text is with the alpha at zero and then let's go to the graph and delete everything except to things which we will need to add so let's create a custom event which we will call something as um show message animation okay and basically the only thing that we will do in this custom event that we will call later on is get the show message animation and use play animation okay and that's it let's do exactly the same with the hide so custom event hide um message animation put this over here and just get HDE message drag it play animation and plug this in and you can see that wait okay there we go you can see that now as you can see we can call this to events and it will play the animations that we need so for this let's go back to the BP danger zone and right um right after the print okay let's go ahead and on the enter area create a new widget in this case what widget well of course it's going to be the dangerous Zone and we need just need to get the return value and add it to the U viewboard which is basically added to the screen and with that said there's one last thing we need to do which is of course to get the return value of this widget and call the uh show message animation and with that we're good to go it will play the animation so let's go and press play and now we can go through our trigger and boom and entering then your Zone appears on the screen pretty cool so now we need to set up when we exit the zone so let's just go and get the return value of this okay which we are going to make sure that is valid just in case okay so we will only continue if the widget is actually there and then if so what we're going to do is just go and um call the Hide message animation okay so it will go ahead and hide and then after a bit of delay which will be a bit different to this okay so let's add a sequence here a delay of I think it was 1.25 the length of the animation what we're going to do is just get this return value and just do a remove from parent okay which will basically go ahead and delete this widget from our screen completely so now if I go and press play you going to see that we will have both States going on you going see my area in front of me if I go and enter boom we can see the entering danger zone animation come in and if I exit the area we can see that it will fade away and then we can go ahead and enter again it will showcase as you can see and we can go ahead and exit again and everything will just work so that's it guys if you found this tutorial helpful I would really appreciate it you can like video And subscribe to my channel we have full access to the pro files through patreon or YouTube members join my Discord Ser follow me my socials and now yes with all that said bye-bye [Music] f
Info
Channel: Gorka Games
Views: 4,530
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 dagner zone, tutorial, quixel, megascans, unreal engine danger zone, danger area in unreal engine 5, ue5 danger warning, danger message tutorial, widget danger, unreal engine 5 how to dangerous message, unreal engine 5 danger area trigger, unreal engine 5 trigger danger area
Id: 2i7TtFy4WE8
Channel Id: undefined
Length: 9min 7sec (547 seconds)
Published: Wed Feb 21 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.