(Beginner's Question) Connecting two blueprints

Hey there, I’ve been getting into UE4 for the last few days and, who would have guessed, I love it!
Now, being exclusively an artist (more like aspiring artist, but well) I was extremely excited for the Blueprints visual scripting language. I’ve been playing around in it for a while now, not having many problems I couldn’t solve by reading about the functions in-engine. But now I seem to have a problem I can’t really solve, which is connecting two blueprints. What I mean by that is the following:
So far I made a class-blueprint for a simple bowl of fire that enables input when a player-controller is in it’s trigger box. Once you press E you activate the fire in it. So far so good.
So I wanted to add a functionality for something to happen once all four bowls are lit. It doesn’t really matter what it is as I currently only want to know what to do to connect my class blueprint to another one. I read about using custom events when I went through the Content examples but I cant figure out how to use them. I hope that someone in here can help me with that!
To show you how far I came, here’s a picture of my blueprint and the In-Game view, so you can visualize it for yourselves.
The comment boxes are there because I feel like i can organize myself better with those, I guess.
Cheers and thanks in advance for your answers!

I have the same issue so I’d also like to encourage users who’ve got this figured out to post. Also if you figure this out yourself, please share.

Let me know if this helps at all:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintComms/index.html

There are also these methods of getting Blueprints talking to each other:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html

I already figured this out before i read those docs but they are exactly what you need.

Use event dispatcher to send info from a blueprint and use on event to receive info, you can pass whole objects doing this, by adding a reference to the object in the event dispatcher and when you call onevent in the other blueprint you recieve.

Im not very good at blueprint yet but I was once rather adept at kismet…
Maybe each time a fire is activated it could tell an INT in the level blueprint to go up by one, and also activate an event in the level blueprint that would check what that INT is at, and if its 4 or more then something happens, if not nothing, i guess you could have a tick event that checks that in the level blueprint, but that would be running all the time and I think you’d only want to check when a fire is lit or unlit so it wouldn’t need to run all the time…

edit: event dispatcher sounds legit, going to have to read up on that one

I can provide you with blueprint example if you need?

Wow, I didn’t even know there was that docs site. Thanks, it helped me a ton! And thanks for offering to provide us with a blueprint example, but I don’t think it’ll be needed. Not for me, anyways. That site is enough for me as a framework to expand upon, as I like learning the software while experimenting. Cheers!

Since both and Jerizo both PM’d asking for en example I will post this screen shot here, ask any questions.


When the static mesh created in spawnActor is clicked on with the mouse, the Onclicked is fired and the BP1 calls the custom event called GemClicked.

The BP2 has a bind event to GemClicked which listens to any GemClicked events and prints the mesh name.

Hope that’s clear.

This video might be useful as well: - YouTube

I don’t get how that works.

In Match_Gem BP you create an EventDispatcher (GemClicked), and call it. Easy.

But how are you getting the Bind Event and Custom Event to appear? I don’t get that options unless I create another Event Dispatcher in this BP. Does one of these BP’s have to be a special type like Level/etc?

Edit: Yes, it seems like only the Level BP can listen to the event. Why can’t we listen for events in a regular actor? Also, it’s context sensitive, so it’s only listening to the event for that one actor? So duplicating that actor won’t work?

Both are standard blueprints.

To create the bind event and Custom event you just need a reference to an actor , which you plug into the target.
I created the actor reference by spawning a new actor.

That video posted by JamesG should show you everything you need to know.

Since when does epic have devs in uk? Do they have offices here?

have you checked out the UE4 content examples (blueprint communication map)?
In the very first example they communicate between two blueprints just by using a custom event and accessing that from another blueprint by using a reference variable to gain access to it.

This seem like the way it’s supposed to be done but like all the other approaches it doesn’t work for me.

The flow always stops after the stuff in my first blueprint is done and never picks up at the custom event in the next blueprint regardless of what technique I use.

This is a screenshot of the entirety of the nodes used in the content examples map (the less important stuff is darkened) click for large version

http://i.imgur.com/LYiZwDql.png

The “BP_light_bulb_basic” is a blueprint that has been placed in the scene.
You must select “BP_light_bulb_basic” in the scene and while it is selected then you open the

“BP_buttonLight_bulb_basic” and right click, this will give you the option to add the toggle light event from the “BP_light_bulb_basic”.

Remember that right click menus in the blueprint editor are context sensitive.

The example I originally showed you is for creating the blueprint at run time instead of placing each one in the scene manually.

alright man thanks for your input, I got it figured out now.

This is actually all it took.

I have a similar situation where I want to communicate between two blueprints. I have a couple of variables that change in my MyCharacter blueprint and I would like their information displayed on my HUD. Closest I’ve come to making this happen is to add an object variable to my HUD Blueprint and use that to ‘get’ the variable information from my MyCharacter blueprint. However when I do this it says that my Variable is “Out of Scope” and it returns 0 instead of its number. Any idea what I could be doing wrong here?

If your variables are in MyCharacter you can use the “Get Player Character” function. Bind it to “Cast To MyCharacter”. Drag from “As MyCharacter C” and you should be able to access any public variable or function in the MyCharacter blueprint. I access the PlayerScore which is a variable I save and update in MyCharacter in the example below.

How can we replicate this from C#?

TriggerScript (sends event)



// CREATE EVENT
public delegate void EventHandler(float testFloat);
public static event EventHandler TriggerWasEntered;

void OnTriggerEnter()
{
    // SEND EVENT
    TriggerWasEntered(0f);
}

LightScript (recieves event)



void OnEnable()
{
    // SUBSCRIBE
    TriggerScript.TriggerEnteredEvent += TurnOnLight;
}

void TurnOnLight(float floatValue)
{
    // TURN ON CODE
}

If I have a 1000 lights they will all turn off when the trigger is entered.

The example they have which turns on/off 6 lights has a strange setup which makes an array out of everything in the level of that class type, but that doesn’t seem to be a good way to do it for a lot of lights. Does C++ just not support this?

Make the trigger accept an array of lights it triggers:

Yeah, but that’s not using events. Turning off the lights isn’t the important part. I think I found the answer here: