Targeting blueprint class instance from other blueprint

Howdy,

I’ve been pulling my hair out over this, so instead of tell you what I tried, I’ll just explain what I would like to do with a little bit about how I’m set up

I have a blueprint class called DOOR, of which there are several instances in my level. There is a puzzle to solve, and when that is complete, I would like one specific door instance to open. There is no collision detection used so the typical events to that would help provide a reference don’t seem to apply…

The door blueprint class has an “open door” event, but the logic for the puzzle is in a different blueprint, and when it is solved, I can’t call the custom event because I can’t figure out how to target the SPECIFIC instance of the door blueprint class.

I have also tried using an Interface class, but I run into the same problem with not being able to target the persistent level actor.

The only place where I can get close is if the logic for the puzzle is on the Level blueprint, because there, I can get a reference to the persistent level (Door) actor.

Cheers,

Sterling

This is really easy to do…

Within your ‘puzzle’ blueprint, create a ‘door’ variable and make it public. Place your puzzle and door into the level.
Select your puzzle blueprint within the level and look in the properties for the ‘door’ variable you exposed. Click on the little eye dropper icon, then click on the door you have in your level.

Within the puzzle blueprint, check to make sure that the door variable is valid, then call the “OpenDoor” event on that door once the puzzle has been completed.

When you run the level, players will solve the puzzle. Once this event happens, the puzzle blueprint will trigger the “open door” event on any door you bound to it. If you want more than one door to get triggered, you can create an array of doors and loop through them and call the event on them.

I think I’m close. Since my puzzle code is actually in my game mode, which is created at runtime, I can’t really put it into my level. However, I made the variable a reference to the Asset ID of the door I want to open. It doesn’t give me any errors, but it also doesn’t open the door. Actually I placed a bunch of breakpoint and traced the flow of code, and while it says the reference is valid, it isn’t calling the other instanced breakpoint, so I must be referencing the wrong instance. When I hover over the instance in the level, I get a unique ID and it is the same that I selected in the details panel I my game mode blueprint.

Thoughts?

I’m not sure what delegates are, so my head is in the cloud there (so much to learn) Anyway, I place breakpoints around the area where the event should be called, and I can see that my variable to the object Asset ID is the same as the one in the level, but the event in the door BP is still not triggered, so it must not be referencing it. I can see the flow of control going into the Event Call node, Where is goes next is to the gamepad controls

  1. I’ve done this myself with my doors and particular events, so it’s 100% possible.

  2. This shouldn’t go into a “Game Mode” blueprint. Game modes are meant to detail out rules of how a particular game match should be played – ie, capture the flag, last man standing, etc. Instead, you’d want to keep track of this ‘state’ data within a game state or game instance. In fact, the game state generally would only need to contain a boolean value to indicate whether the puzzle has been solved or not. The actual puzzle solving trigger would be what causes the door to open, there would be no need for a middle man type blueprint.

  3. Try placing a breakpoint at the event which triggers the door to open (DoorOpen). Bind a debug key to trigger that event and make sure that the event can get triggered. You may need to use delegates.

Alright, I finally got it to work, by putting my puzzle logic in its own BP. But, What I like about the interfaces was being able to call function with variable attached, which isn’t possible with custom events, as far as I know.

You can define input parameters for both events and functions. You also can implement interfaces in custom Blueprints.

If you’re having problems doing either, what are you trying to do?