toggleable lights blueprints?

You could give the BP a variable of integer and use it as a tag.
The same with the light switches. If a switch is used, cycle through all lights in the level and toggle only those where switch and light tag match…
The walk-up-to lights can be toggled via a trigger box volume and its begin/end overlap event handlers.

I got 5 different lights static meshes that are to be placed around my game level. I haven’t placed any of these lights around my level. I also have a wall light switch mesh as well. I want to be able to have the player walk up to light switch and it will turn on the “A” lights. I also have some lights which the player just goes up to and turns on. How can I achieve this?
P.S.
Sorry if this is a stupid question but I couldn’t quite find what I’m looking for on google search engine.

So if I have say 3 “Light A” placed in a room, the light switch which would be a actor BP that has a integer variable of 0 or 1. When I select press it the 3 “Light A” lights up and if I press it, it will turn off. I’m not sure how to begin with this. Can you post a example blueprint?

Not exactly an example code, but here in short:

  • Create a BP class, drived from “Actor”, called “LightBP”
  • Add a point/spotlight component
  • Add an integer variable and name it “TagID”
  • Create a BP class, drived from “Actor”, called “SwitchBP”
  • Add an integer variable and name it “TagID”
  • Now place some lights and switches in your level.
  • Give some lights the same ID. Also give the ID to a switch.

That way, you can control any number of lights with any number of switches.

In order to toggle the applicable lights, you need to create a BP graph for when the switch executes.

  • Run a for-each loop over all actors in the game
  • Within the loop, test if they are “LightBP” actors
  • If so, check the value of the “TagID” variable of that lightBP actor
  • If it is the same as the switch “TagID”, then toggle the light, else dont.