How to stop automatic doors from closing when one player exits but another player is still in the trigger box?
I have created basic automatic doors for my game that open on Event ActorBeginOverlap and then close on Event ActorEndOverlap. So when a player enters the trigger box, the doors open and when a player exits the trigger box, the doors close.
The issue is that if Player A enters the trigger box, the doors will open. Player B enters the trigger box and the doors remain open. Player A goes through the door and exits the trigger box and the doors close in Player B's face. However, what I want is that if any player is still in the trigger box, the doors will not close even when a player exits the trigger box.
Any help with this would be really appreciated! I know there must be some way around this but I haven't been able to figure it out yet.
Thank you ahead of time!
asked Jul 18 '17 at 09:34 PM in Blueprint Scripting
What I would do is create two booleans to keep track of who is and isnt in the box.
Bool PlayerAInBox? Bool PlayerBIsInBox?
You can check which player enters and exits the box and set their corresponding boolean using on and end overlap.
In event tick you could have a branch saying if ((not)PlayerAInBox AND (not)PlayerBIsInBox) then call close the door.
If you want to compensate for multiple players, an approach could be to make an array of booleans each indexed with the number of players.
Hope that helps.
huh when a player leaving the box why you dont just use the node IsOverlapping Actor with you player list to see if someoneelse is still inside the box.
answered Jul 19 '17 at 04:30 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here