One blueprint with 3 interactable doors trouble...

Hey everyone, I have been having an issue trying to have 1 blueprint have 3 doors on it, like a cabinet. Anyways I have the main body of the cabinet, then all the doors are separate objects that were added to the BP. So my issue is, I can get one door to open on my Event Interact, and I have been trying to hook up an array so that I can use the index number to tell which door is which. Unfortunately I can’t figure out how to get that index number based on which cabinet door was interacted with. Heres what I have so far, any advice is much appreciated :slight_smile:

Try something like this:

For the interaction part, what are you doing currently? You only showed code that happens after the interaction.

If you interact via a line trace, then you’d probably end up with a reference to the actor itself, in which case you don’t need the array index, you can just find the same actor in the array using a Find node.

Create the door mechanic as its own actor. Place the actors in the scene. Then select all actors that are required, create blueprint. You now have a prefab.

Sorry for the late response, I was at my night job lol. Anyways, yes I do use a line trace for the interaction script, then it sends the interact message to whatever I am interacting with.

So I can use the find node to figure out which component of the BP I am interacting with?

The line trace returns a hit result. One of the results from that will be an actor. Put a print string to see what it is.

Now you’ll have direct reference to the interacted actor, so you don’t necessarily go searching for it in an array - you could have the door animation in the door class and just call on it directly there when the interaction occurs.

Or if you want to keep your code like it is, you just pass that actor reference as an input for the Event Interact, and you use Find to identify that actor in the array.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.