Problem with cast

I’m currently trying to create a small system where I set up multiple switches for controlling lighting, and having a main breaker in each level that controls if each switch should be able to turn on a light.
I tried to do this by having the switch casting to the breaker to check the boolean “IsPowerOn”. If it’s true, it then allows itself to turn on the lights. It always checks if this is true, and the moment it’s false, it permanently toggles the lights off until the power is on again.

But I think I got the whole concept of casting wrong. I simply want the SwitchBP to be able to check if the power is on, which is decided by a boolean in the BreakerBP.

Here’s the blueprints.

So far I think I’ve got it right. I started with some keyboard inputs in the SwitchBP to control the power bool, and the light turned off and on when it was suppsoed to. But it’s about finding what I’m supposed to connect to the “object” in the Cast node.

the main issue you have here is that you have nothing connected to the object pin. a cast is basically a comparison (is object A similar to object B). the way you have it now is like saying is nothing (or rather a lack of a item) like object B.

try making a variable and in the details panel change its type to oldbreakerbp or actor. then make the variable editable. now select the switch bp in your scene and set the variable to the oldbreaker in your scene. also have the variable plugged into your cast where the object pin is. this should fix your issue.

Wow, that actually worked! I didn’t know what to put into the object pin, but this makes kinda sense I guess. I think I need to learn more about object variables, had no idea I could select actors in the scene to a variable like that. Thank you very much!