I have two Blueprints. The first is a can, that can be selected in the level, and the second is a Generator, that slowly runs out of fuel. When the can is used, I want it to fill the Generator. I can do this easily via the Level Blueprint, but it’s starting to get really messy, and wondered if there is a way I can make the two BP’s communicate.
I’m guessing I need something hooked up to the “object” pin on the attached file.
edit To answer your question though the object is the name of your Generator Actor in the level, if you have more than one generator though you will need some way to make this dynamic like an Event Overlap Other actor output
I see you already have an interface set up so you don’t actually need to cast. Instead what you can do is create a function called GiveFuel with a Int/Float variable input in the interface. Send a message using the interface as the middle man to the generator, on the generator bp you will call Event GiveFuel, which will have a Int/float output which you can use to set the fuel amount.
Make sure you generator has the interface as well. Your mileage may vary, I have had issues with interfaces where I couldn’t send messages but this was usually fixed by restarting. Sometimes I have to turn off Context Sensitive
I don’t suppose you could explain that in a little more detail could you, please. I’m really quite new to this.
You said I have an interface set up - well, yes, I do, but it was taken from a Youtube tutorial on how to make an inventory. I’m still quite baffled as to how it all worked, but it did (!) and I’ve decided to expand on it. I have made several things work, like collecting a flashlight and toggling it on and off, and using a key in a locked door, but I just can’t seem to get the Fuel Can to Generator thing working.
I made a Custom Event in the Generator Blueprint called “Fill Tank” which sets the Fuel Float value to 100. If I call that by pressing, say, 9, in the Level Blueprint it works fine. I just can’t seem to call it from another Blueprint (the Fuel Can, once Used, in this case). With my flashlight, I find the item in the world, pick it up, select it from the inventory, and it works. I’m familiar with accessing the Player Character, however. I assumed filling the Generator with fuel would be the same, but obviously not.
I edited my post above to answer what should go in the object input, you can select your generator actor from the list. I don’t know enough about interfaces to walk through it haha
I was hoping it would be as simple as it is using the Level BluePrint. All I do there is select the generator in the world, then right click and have the reference to it. Thanks for taking time to help me.