So I am currently trying to make an elevator that will go to different floors. I am doing this via 2 blueprints, one of which is the doors placed on the different floors, which will only open once the elevator is on that relevant floor and the other BP is that of the elevator.
I am going about this by once the player reaches the door blueprint and calls the elevator, it will then give off the variable of which floor they are on and thus the relevant location so the elevator can travel to this floor. However the part that I am struggling with is that of the communication between the elevator blueprint and the different door blueprints. I am able to communicate just one of the doorBP with the elevator just fine but that’s only one instance and I am unsure how I would do this with the other instances as you can only seem to choose one at a time (unless you can change this somehow)?
Perhaps I am going the wrong way about it?
Apologies if this is a simple question, thanks for your time.
I created a custom trigger volume that can affect as many targets as you want. I created a public variable called targets. Its an array of actors. When the trigger itself is triggered, I do a foreach on the array and trigger each of the actors. The actors are triggered by a custom trigger interface. I’m willing to bet you could use a similar technique to specify everything you need.
@awilliams sorry, I don’t get quite what you mean.
I think I could have explained my problems better.
Essentially when the player calls the elevator, depending on the floor the doors are located it will have a different variable which is public so I can change it for the different floors (so 1,2,3 etc).
The problem I am having is transferring this variable to the elevator BP, as I believe you can choose to only communicate with one instance of the blueprint at a time, so it is only communicating with one of the floors.
In terms of opening the doors and moving the lift etc I don’t have much trouble with, it’s just I can only call the elevator from one floor at the minute.
I encountered a similar issue for my elevators. The solution is to get all actors of class, throw them in an array and compare 2 different variables to check if they’re the same. So for my elevator car I had an integer variable named “Call ID (The floor called from)”, and for the elevator doors I had another integer variable called “Floor ID”. In the editor viewport I set those IDs to be 1, 2, or 3 etc. When the player was overlapping a volume outside the door and pressed a call elevator button it would set the “Current Floor” variable for the car to the number of the elevator doors, their “Floor ID”.
If the variables were the same…open the doors. If not, move the elevator to the doors whose ID was the same as “Current floor”.
I used an array of actors in my setup. Each actor in the array would get information transferred to it. The actual targets implemented an interface. That way I can call whatever function I need without casting.
However I think from what you’re describing I would do it the opposite way. I would have my BPs that call the elevator have an elevator target. They could call the elevator using an interface. The function could have an integer input to tell you what floor was called. Or you could make it a vector and tell it where to go.
Hello,
You can set all in one blueprint too. In construction script, you define the number of floor and add all the elements of a floor with a loop then in event graph you “move component” from current level to destination level with time = difference between them. As long as your floors have the same height, you can use the same blueprint for each elevator you need. Here is an example i did in the past :