AI checking if random doors are open

I’m making a fnaf inspired game for my friends. My vision for one of the enemies teleports between two doors and checks if the one to which it teleported is open. If it is opened it starts a timer and if the player doesn’t close the doors during the timer, the enemy kills the player. I have a problem with checking doors when they are random. How can I check to which he teleported?

Hey!

If I understand correctly you already figured out how to teleport the enemy actor at random doors.

You could use a collision on the enemy that is large enough to hit the door and then check what the enemy is colliding with if it can be cast to your door BP you can have access to its variables and check if the door is open.

Hope this helps, feel free to ask anything if I need to clarify it a bit.

I figured i have to use blueprint interfaces, but it seems that the enemy does not recieve the “meesage”. The result is, that I can change the state of the doors, but whoever sends the “message”, be it the player or the doors, nothing changes for the enemy

I am new to coding in general, so maybe I don’t know something crucial

So first the player character checks with which doors he interacts and then sends a message about the acording doors

The second one is the enemy, who should recieve the message and switches between the doors being colsed for him or opened

I feel i could make this code better, maybe it is just wrong and that’s why it doesn’t work. Idk

PS: Some word are in Polish, but i guarantee you, the names are assigned correctly


Nwm, I had to reference the enemy actor for it to work. Thanks for help