Movable vector in blueprint for adding component at the location specified.

I am making a blueprint light switch. In the BP i have a light switch. I will place the BP into my level and position it on the wall. I want to add elements to an array so that in the editor I can add/remove some number of pointlights. The lights will have their settings adjusted as I wish.

What I want is when I press the plus to add an element to the array, some actor/reference (or even better the point light itself) appears in the editor and I can manually set the transform of.

My ultimate goal is to be able to place the BP in the level, add a few lights by incrementing the array elements and moving the lights into place. Then having those lights and only those lights effected when the switch it toggled.

I can handle most of that. The adding point lights when I increment the array elements is the part I cant figure out.

Anyone able to “point” me in the “light” direction? See what I did there?

Any help would be appreciated.

Hi,

You could create an ‘Editable’ Vector array with the ‘Show3DWidget’ tickbox checked. That will provide you a little icon that you can move around for each array element you add to determine the value of the vector (it will be the relative location of the icon from the root). Then in the Construction Script you create a ForEachLoop that iterates your vector array, and for each element, you add a Point Light Component. Notice that the ‘AddPointLightComponent’ node accepts a RelativeTransform input: just create a transform using the ‘MakeTransform’ node out of the value of the currently indexed vector element (using it for the ‘Location’ obviously), and plug it in as the relative transform of the created light component. You could also then add them to an array to be able to switch them later.

Thanks. That actually is exactly what I ended up doing. I created an array of vectors with the Show3dWidget checked and it works perfectly. I then add a point light component (in the same ForEachLoop and assign the coords of the currently indexed vector. I also add those Point lights into an array as well so I can access each of them.

Here is how it looks in the editor - https://youtu.be/koG5CnY-95Y

The problem I have now is I want to reference each point light to set various parameters I am not sure how to do that. When I place a visibility node or a intensity node with the intent to turn the lights on or off I need a target. UE4 won’t let me use the currently indexed PointLight from the array. Maybe I’m just doing this incorrectly.

So… what happens when you drag a wire off *get *and type ‘set intensity’? This should work.

Ok. I got this working. Here are the result. [video][/video]

No that doesnt work. Because the editor doesnt know yet what object/component is. So it doesnt know what variables are relative to that.

Edit: I should say that that is how it was behaving before. After I rebuilt the Point Light Array (as shown in the last video I posted) it does work.

I need a little more help. This seems to work fine with one instance of the blueprint in my level. If I add a second (and I assume subsequent) instance of the blueprint a problem occurs. The switch for one BP effects the lights for the other, and not its own … and the other BP’s switch does nothing.

At some point I thought I saw a “local” option. I thought I might need to make the point Lights local to the blueprint and/or make the switch action effect only local point lights. I can’t seem to find that anywhere now however. Does anyone have any clue what I might be doing wrong? The Video linked above shows the entire node network and the functioning single instance in a test level.

If needed, I can post a video of the issue later tonight.