Talk to specific BP instance?

Hi.

Is there a way to call custom events on specific BP instances?

If I have 3 doors which are all instances of one blueprint. How can I use another blueprint to talk to specific doors? It seems that in the details panel I have to pick one instance when I reference it inside a blueprint. I want to be able to talk to each one when I need to.

I thought maybe blueprint interfaces might be the way to go? But I’m not really sure.

Any help would be huge. Thanks guys.

Your hunch is correct, blueprint interfaces are the way to go. Can you tell me more about what you’re trying to achieve? Do you want to operate these doors through buttons or do you want to open the one you’re looking at?

You have to get the door you want to interact with.

Usually you would do a “Trace” when you want to get a door. I mean you usually have two ways of opening a door. Either with a button or once you get near it.

The second one would be done within the door blueprint so you fire a trace with the button press. You get whatever the trace hits, break the hitresult and get “actor other”.

Like this you have the correct door and can start using that specific door.

Well, it’s a little different than that. I’m not sure a trace would work?

It’s complicated but, I have 3 doors, all instances of one blueprint. The blueprint has a number variable and in the scene I’ve given each door a number based on that variable. So basically I have door 1, 2 and 3.

I also have a box in the scene. It also has a number variable on it. What I would like to do…is when I give that box a number between 1 and 3 it fires off a custom event to the door BP telling them to open.

So basically, the box BP variable is set to 3. The door with the variable number of 3 opens.

So that’s it really. I just don’t know how to speak to that specific instance.

My response down further explains it (hopefully). I don’t know much about interfaces but it seems correct. I’m running out of ways to talk to other blueprints lol.

Oh. I wasn’t expecting a static environment.

In this case simply use the Level Blueprint. You can reference specific objects within the level directly meaning you don’t even need those variables but can simply pick the door and volume you want and manually hook them up there.

Whenever there is stuff which should only work in one level use the levelblueprint.

If you want this to work in multiple levels make the volume in the size you need. Add a vector which you make public and set your volume to that location. You will be able to place that vector as a point within your level meaning you can set up the volume at any place in any relation to your door whenever you need all within the same blueprint meaning you don’t have to call something from a different one.

Hmm, I’m not entirely sure I follow.

So yes, I want to be able to use do this in multiple levels so I didn’t consider the Level BP.

So let me see, I create a box volume with a public vector variable…and then when I need to, place it on top of the doors I want to have open? So I guess something like…box volume is overlapping this door, open this door?

No. Just have a door blueprint. Add a box volume to it and check if the player is in it.

Then add a vector variable (public) and set (in the construction script) the location of the volume to the vector.

Like this you can move the volume (in which the door should open) or you simply set it around your door without the possibility to move it.

That way whenever your player goes near the door it will open.

Erasio’s answer is one way to go, and definitely works. Simplicity is sometimes best. I have a few alternatives that might work in other cases where any event in one blueprint might cause action to happen in another blueprint… With pictures!

The Top case shows an event that is called from one blueprint and fires on all actors of the specified class. It passes the magic number and all checking is done at the other end.

The middle case has the caller check the other actors for matches and calls all of them that match.

The third case stores the instances in an array indexed by their magic number. It checks to make sure they are valid before inserting or calling.

I hope one of these might help you to get going on your own implementation.

Pictures: This is all just prototyping, so none of this is an exhaustively tested implementation.

Your first solution was perfect! I’m very new to Blueprint and I don’t know a lot about arrays and classes yet but your picture helped me figure it out! Classes and Arrays were exactly what I needed.

Thank you so, so much for the help :slight_smile:

Oh I see, that’s actually kinda neat. I’m going to need that idea of yours for elsewhere in my project :stuck_out_tongue:

Seriously though, thanks a lot for taking time out of your day to give a stranger a hand.