Hello,
I’m currently working at my very 1st UE5 project. I used the First Person template, then created my whole “level”, but now I have a problem with doors. When creating them, I was basing on this video: How To Create A Door (Blueprint) - Unreal Engine 5 Tutorial - YouTube
Because I didn’t want to close the doors, I didn’t make it exactly how the video presents, but even though, they still work. My blueprint for them looks like that:
I placed more than only 1 on my level, so I also created a variable “ID” for them and I set different ID for all doors at my level. Now there’s where my problem begins… I don’t want them to open when player is close, but only when the target that is in other place (not on the door) was shot, or when multiple targets were shot at least once.
After some research I tried to make it like it was described here: Shooting a button to open a door?. I created “Custom Event” and renamed it “OpenDoor”, but unfortunately, I don’t understand the next step, “then in your level create a box trigger and also drag in the door bp”.
I opened my Door Blueprint, but how am I supposed to drag the box trigger there? I just placed it on my level by using option “Quickly add to this project”, but I can’t just drag it to Door Blueprint Event graph. It’s just impossible (or i’m doing something wrong?). I also can’t
Right now my Door Blueprint and Level blueprint are looking like that:
Hey @NexUs. Made this quick demo to try and make it work how you want. It’s a bit different than the linked tutorial but think it could be of more help.
This is how it works:
The trigger actor
Only component with collision is the Box, it’s set to Block All.
Create a function to invert a bool and call a dispatcher:
Hi @pezzott1,
thank you very much for help. I tried to do everything as you described and I understood the overall idea. However, I still have a problem, because it still isn’t working at all.
I wanted trigger to be small, round and without any glowing parts, so instead making it as a box, I made it small, round and black. Then I made the Toggle State function, but since I don’t need the trigger to glow, I didn’t create the Set Glow Color function. After that, I entered the Event Graph tab and created that Event AnyDamage thing.
As for the door I created the Array in the way you told me to and then I created also the Bind Lock Triggered function. Atfter that, in the Create Event field I selected “Create Matching Function” and it created a function that I renamed to “Locks Check”. At the end, in Event Graph I made everything like you showed on your screenshoot.
When all things mentioned above were done, I placed the door and the trigger on the wall next to it. I also renamed that trigger to “StartDoorTrigger”. After that, I left clicked on door and added 1 element to the array. When the “Index [0]” thing appeared I changed its value to the “StartDoorTrigger”. It looks like that:
That’s all I did and for me it looks almost exactly like how you described and showed on your screenshots (the only difference is the lack of Set Glow Color function and the names for Door and Trigger actors), but for some reason when I did it, it’s not working.
I was trying to upload here more screenshoots, but since I’m a new user here, I can’t upload more than only 1.
I was trying to find the problem for the entire day and still got almost nothing…
Do you have any ideas what could I made wrong or what should I check?
Ok. The events should execute in this order: Trigger recieves damage | dispatcher fires | door recieves the call of the dispatcher and executes the binded function | finally execute the custom event. So all we have to do is place print nodes at the start of each to know what is executing and when.
Lets try and follow the chain to see what is not working. Add a print at the start of each so we can visually track what happens when the trigger gets hit. The result should look something like this:
Ok, I did as you told me to and something strange happened. For some reason none of those texts showed up. I guess that could mean that I’ve messed something up right at the beginning, when I was creating the trigger actor? Or maybe I should’ve changed something also in the Projectile Blueprint?
To be sure if it’s not a problem with my viewport window that texts doesn’t show up, I also added one text to appear right after I start the game and it worked.