Hello,
let’s say I have 10 Lights, and with the same switch (pressing F key) I want:
first click=turn on 5 lights.
second click=turn on 10 lights.
third click= turn off all of them
thanks
Hello,
let’s say I have 10 Lights, and with the same switch (pressing F key) I want:
first click=turn on 5 lights.
second click=turn on 10 lights.
third click= turn off all of them
thanks
Hi man , its simple, you have to put in your blueprint , (or in your levelblueprint). a variable.
To make it simple.
Lets add a variable int to you blueprint. Call it CLICK_N.
When your event ( F ? ) get fired , use a Switch on int attached to the variable CLICK_N .
Now you can use these 3 output 0,1,2. to:
For example, if is 0, you have to put a LOOP from 0 to 5 and set these 5 light in the array you have prepared “on”.
Then set the CLICK_N to 1.
If CLICK_N is 1 , you can loop for the Whole array and set on all lights. , Now Set CLICK_N to 2.
If CLICK_N is 2, loop the array and set off all. Set back the CLICK_N to 0.
THE ARRAY OF LIGHT:
To set on and off the lights, you have to use theyr reference.
To make it simple, probably you could make an array of pointlight_object. make it customizable.
And then in the editor , attach every pointlight you want to use, to the array of the blueprint.
Hello, I am confused with the array.
I have one light BP and one trigger BP,
the 10 lights are 10 class BP in the scene and the trigger turn them all on/off with the ‘get all actor of class’
how do I do the array of BP?
Hi man , you can do the array in the blueprint but its more clear and easy if i show you how do it in the editor.
Otherwise you have to script some evaluation to check wich is the light you want and so on…
Create a variable in your Switch, as show , be sure that is selected as Array and is editable.
Now, hit the Compile button. Is important , otherwise you cant edit the array.
Now go in the editor , and select your switch . in the detail panel on the right you will see that now Array is avaible.
Expand it and add as much light you need. use the select scroll down to select a light and check with the Maghifier button if is the right one.
Then you can do 2 scripts.
Use the for each loop , will use every reference in the array to put them all on or off.
Otherwise use a loop, and you have to say from wich one to wich one do what.
Be aware that the first Pointlight is at the array_0 … as shown in the upper right part of my screenshot.
Hope its clear
It is quite simple, You need to have a variable that stores a value of how many times you have pressed F, then you need to get that variable and turn on/off the lights that belong by that number.