How do I activate a Blueprint from another Blueprint?

Hi

I’m attempting to create a light switch that turns on a collection of lights.

I have the light set up so that you can turn it on by walking up to it and press the F key (the light set up created in the Blueprint tutorials on youtube). What I want is to be able to turn the lights on from a switch that controls any number of the lights I place in the scene.

Switch
Key F is pressed and activate the blueprint for the light.

I’ve been tying to find the right sequence of nodes for this to work, but haven’t been able to.

Any help would be appreciated.

Thanks

Dan

There is a .umap in the Content Examples project which shows that. It even has a switch and multiple lights. I didn’t open the eventgraph for that one yet, but I imagine actually there are several ways it could be done.

You want to have a Toggle function in the Lamp class which gets called from the Switch class after the input event… the method for that is in Blueprint Communications

Here is the youtube Unreal Engine version: https://www.youtube.com/watch?v=s5pIrpI7py8

Here is mine (two versions, just click the Process tab at http://www.tomofnz.com/

Hey

Thanks, I’ll take a look for that .umap, I’ve already looked at the youtube one, but could figure out how to make it work with another class blueprint, as that one uses the Level Blueprint.

I’ll have a look at your tutorial when I get a chance.

Thanks
Dan

Hey

So I’ve got the Lamp Class set up with the custom event in it. and the Switch class set up the same way they are in the .umap example, however no matter what I do I can;t call the Event in the Lamp class, it doesn’t appear in the when I right click and search for it.

Lamp class

Switch class

Howdy,

You could do this through [Blueprint Communications][1], another way to do it without would be similar to what is below. Just depends on what you’re after and the usage I suppose. Check out the link for more on communications, I’m not sure what you’re ForLoop is for in the switch class.

-W

Well, I don’t want to mislead you at 1.45am as I’m really sleepy, but it looks like you are getting some of the way there.

You need to tell NewVar to point to your blueprint actor WallSconce_C (the _C is what the editor adds).
Set up this in the variable properties for NewVar.
Then you drag NewVar into the graph and choose Set when you let go, and feed it the execution line from the Cast to WallSconce you’ve done already in your image. And the blue out var goes into the Set NewVar blue input.

Then you drag NewVar onto the eventgraph again, this time using Get when you let go. And you drag from the blue out of the NewVar you’re getting and there you should see the event you made in WallSconce called ToggleLight.
Just note you also have a function you’ve added called ToggeLight (but maybe that’s empty?) You could call that instead of the custom event. Up to you. I’m not sure if one might work vs the other off hand…

Anyway, the other problem is that in WallSconce blueprint, your Branch (after the event) has no condition that’s changed. You could instead use a Flip Flop (from the flow logic functions) which equates to a Switch from Kismet.

Hope this makes sense … note, I might be wrong. If you can’t make progress, let me know and I’ll try once I get the engine update sorted.

And yeah, you don’t need a For Loop node after Get All Actors of Class … I’m pretty sure you want a GET node, but otherwise the same.

Maybe you use the ForLoop to effect many actor blueprints that might be placed … but I haven’t tried it.

Hi

Got all that set up, but still can’t call the event from the Lamp class in the Switch class, it does’t appear in the list.

Lamp

Switch

I renamed NewVar to WallSconce in the Switch class

I made a tutorial – it probably should be a video, but I was at work so instead I did a written screenshots tutorial in my slowly growing googledoc.

http://goo.gl/jEHT0u

P. 34 I think (on Arrays) … the example is toggling lights all at once from one switch.

I actually made a ‘Quick Shot’ video tutorial on this, hopefully it will be going up in the next couple of days!

SUCCESS!

I have finally managed to get this working. (this attempt was on a different computer, so no idea if it will still work on the other one)

I copied the Blueprints from the example content to the project I was working on, and was able to set up new events and call them.

Then I created 2 new Blueprints, BP_Switch and BP_Light, set them up exactly as was in the examples, and used all the help from here, and it now works perfectly.

For each Loop is necessary if you have more than 1 BP_Light in the scene.

Thank you to all of that helped in this problem, it is much appreciated.

Dan