How do I dynamically assign TriggerVolumes to new PointLights?

Apologies if this is a horribly worded question, but I’m struggling with a project I have been working on.

I’m still fairly new to using UE4! I have a Point Light (PL) and attached Trigger Volume (TV). When entering the TV with a player character, the PL begins to flicker and turn off, with this being reversed when leaving the TV. All of this blueprint scripting is done within the Level blueprint, and will only work with the TV named “TriggerVolume” and the PL named “PointLight”.

If I wanted to make a new light that followed the exact same rules, would I really have to copy this blueprint script again, and replace the references to “PointLight” with references to “PointLight2”, or is there a more streamlined way of doing this (and less messy!)?

Any help is appreciated!

Thanks

Currently I have my blueprint set up like this, with “LightTrigger” being an actor with a collision box (acting as a trigger volume) and “RemoteLight” being an actor with a PointLight attached.

The aim is to not have to rewrite this OnActorOverlap Event blueprint for each and every time I create a new version of LightTrigger and RemoteLight with copy/paste or something similar.

Find attached the blueprint as it looks currently. Is this even possible? How else would I manage dynamic light switches, based on overlaps, in a randomly generated map?

the simplest solution to the issue in a standard level would be to have two actors, one as the trigger and one as the light. the trigger actor would have a collision volume that when overlapped by the player would use a for each loop to call an event on the light actor. to determine which actors to affect i would use an array of the type of your light actor and make it editable so that when the trigger is placed in the level you could tell the array what to have in it. this is basically what i did in the picture below.

near the end of your last post you said you wanted to do this for a procedural level, this complicates things a bit. where this creates issue is because you dont have static objects in the level to get a reference to. so you would need to make a script to say which lights to affect in the level. for example you could use a get all actors of class then run logic to determine which lights were within 500 units and only affect those. you can make these types of conditions as complex as you like but it will be difficult to get the exact effect you want.

also it depends on how you want to implement the random generation. if you were to create a modular system where have a pre-made room and your generation just places them in random locations then you could just have the logic in the room blueprint modules.